feat: add django-whitenoise

This commit is contained in:
2026-07-14 20:29:29 +02:00
parent 9a795dc3c9
commit f986105cf5
8 changed files with 73 additions and 5 deletions
+14
View File
@@ -1,5 +1,7 @@
import json
from datetime import timedelta
from django.conf import settings
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
@@ -246,6 +248,18 @@ class PwaTests(TrackerTestCase):
self.assertContains(response, 'rel="manifest"')
self.assertContains(response, "serviceWorker.register")
def test_the_manifest_is_valid_json_pointing_at_real_icons(self):
response = self.client.get(reverse("manifest"))
self.assertEqual(response.status_code, 200)
self.assertEqual(response["Content-Type"], "application/manifest+json")
manifest = json.loads(response.content)
self.assertEqual(manifest["start_url"], reverse("tracker:today"))
self.assertEqual(len(manifest["icons"]), 3)
for icon in manifest["icons"]:
self.assertTrue(icon["src"].startswith(settings.STATIC_URL))
def test_the_login_page_is_installable_too(self):
# The app opens on the login screen when the session lapses.
response = self.client.get("/admin/login/")