feat: add public h5 dashboard and publish traceability
This commit is contained in:
@@ -66,9 +66,11 @@ class PortalAuthenticationTests(unittest.TestCase):
|
||||
health=RuntimeHealth(True, True, False),
|
||||
)
|
||||
|
||||
def test_only_login_assets_and_minimal_readiness_are_public(self) -> None:
|
||||
def test_h5_shell_is_public_while_desktop_and_detail_routes_stay_private(self) -> None:
|
||||
desktop = self.app.handle("GET", "/", {})
|
||||
mobile = self.app.handle("GET", "/h5", {})
|
||||
mobile_css = self.app.handle("GET", "/assets/h5.css", {})
|
||||
mobile_js = self.app.handle("GET", "/assets/h5.js", {})
|
||||
protected_api = self.app.handle("GET", "/api/health", {})
|
||||
protected_asset = self.app.handle("GET", "/assets/app.js", {})
|
||||
login_page = self.app.handle("GET", "/login", {})
|
||||
@@ -76,7 +78,9 @@ class PortalAuthenticationTests(unittest.TestCase):
|
||||
readiness = self.app.handle("GET", "/healthz", {})
|
||||
|
||||
self.assertEqual((desktop.status, desktop.headers["Location"]), (303, "/login?next=%2F"))
|
||||
self.assertEqual((mobile.status, mobile.headers["Location"]), (303, "/login?next=%2Fh5"))
|
||||
self.assertEqual(mobile.status, 200)
|
||||
self.assertEqual(mobile_css.status, 200)
|
||||
self.assertEqual(mobile_js.status, 200)
|
||||
self.assertEqual(protected_api.status, 401)
|
||||
self.assertEqual(decoded(protected_api)["error"]["code"], "AUTH_REQUIRED")
|
||||
self.assertEqual(protected_asset.status, 303)
|
||||
@@ -207,11 +211,14 @@ class StaticLoginContractTests(unittest.TestCase):
|
||||
self.assertIn('<a class="logout-link" id="logout-button" href="#logout" hidden>', desktop_html)
|
||||
self.assertIn('<a class="mobile-logout" id="h5-logout" href="#logout" hidden>', mobile_html)
|
||||
self.assertIn("if (!session.username) return", desktop_js)
|
||||
self.assertIn("if (session.username)", mobile_js)
|
||||
self.assertIn("if (session?.username)", mobile_js)
|
||||
self.assertIn("response.status === 401", desktop_js)
|
||||
self.assertIn('api("/api/logout", { method: "POST" })', desktop_js)
|
||||
self.assertIn("response.status === 401", mobile_js)
|
||||
self.assertIn('api("/api/logout", { method: "POST" })', mobile_js)
|
||||
self.assertIn("/api/public/h5/months", mobile_js)
|
||||
self.assertIn("/api/public/h5/analytics", mobile_js)
|
||||
self.assertIn('fetch("/healthz"', mobile_js)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user