fix(map): fingerprint static assets on release

This commit is contained in:
lingniu
2026-08-11 18:59:22 +08:00
parent d4593c44cd
commit d1ba129e99
3 changed files with 37 additions and 2 deletions
+6
View File
@@ -64,6 +64,12 @@ class DashboardTest(unittest.TestCase):
self.assertNotIn("totalHydrogenKg", station)
self.assertNotIn("internalOwner", station)
def test_static_asset_version_is_a_content_fingerprint(self):
self.assertEqual(len(server.STATIC_ASSET_VERSION), 16)
self.assertRegex(server.STATIC_ASSET_VERSION, r"^[0-9a-f]{16}$")
index_template = (Path(__file__).parents[1] / "index.html").read_text(encoding="utf-8")
self.assertEqual(index_template.count("__ASSET_VERSION__"), 2)
def test_signed_operations_session_requires_the_operations_scope(self):
with patch.object(server, "LOCAL_ACCESS_CODE", "LN-map-test-code"), patch.object(server, "SESSION_SECRET", b"test-session-secret"), patch.object(server, "SESSION_TTL_SECONDS", 600):
principal = server._authorizer().authorize_access_code("LN-map-test-code")