diff --git a/combo/apps/pwa/templates/combo/manifest.json b/combo/apps/pwa/templates/combo/manifest.json new file mode 100644 index 00000000..1fd85fe8 --- /dev/null +++ b/combo/apps/pwa/templates/combo/manifest.json @@ -0,0 +1,23 @@ +{% load static %}{ + "name": "{% firstof global_title "Compte Citoyen" %}", + "short_name": "{% firstof global_title "Compte Citoyen" %}", + "start_url": "{% firstof pwa_start_url "/" %}", + {% if theme_color %} + "background_color": "{{ theme_color }}", + "theme_color": "{{ theme_color }}", + {% endif %} + {% block icons %} + "icons": [ + {% for icon_size in icon_sizes %} + { + "sizes": "{{ icon_size }}x{{ icon_size }}", + "src": "{{ site_base }}{% static "" %}{{ css_variant }}/{{ icon_prefix }}{{ icon_size }}px.png", + "type": "image/png" + }{% if not forloop.last %},{% endif %} + {% endfor %} + ], + {% endblock %} + {% block extra %} + {% endblock %} + "display": "{% firstof pwa_display "browser" %}" +} diff --git a/tests/templates-1/combo/manifest.json b/tests/templates-1/combo/manifest.json deleted file mode 100644 index 600e5f1a..00000000 --- a/tests/templates-1/combo/manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "test" -} diff --git a/tests/test_pwa.py b/tests/test_pwa.py index c5fc11a1..59e6d22d 100644 --- a/tests/test_pwa.py +++ b/tests/test_pwa.py @@ -26,12 +26,9 @@ pytestmark = pytest.mark.django_db def test_manifest_json(app): - app.get('/manifest.json', status=404) - - templates_settings = [settings.TEMPLATES[0].copy()] - templates_settings[0]['DIRS'] = ['%s/templates-1' % os.path.abspath(os.path.dirname(__file__))] - with override_settings(TEMPLATES=templates_settings): - assert app.get('/manifest.json', status=200).json['name'] == 'test' + assert app.get('/manifest.json', status=200).json['name'] == 'Compte Citoyen' + with override_settings(TEMPLATE_VARS={'global_title': 'FooBar'}): + assert app.get('/manifest.json', status=200).json['name'] == 'FooBar' def test_service_worker(app): app.get('/service-worker.js', status=200)