Expose protected operability metrics
This commit is contained in:
parent
a336f594e7
commit
2bcda7f26f
3 changed files with 56 additions and 0 deletions
|
|
@ -73,6 +73,19 @@ class PortalApplicationTests(unittest.TestCase):
|
|||
self.assertEqual("200 OK", home["status"])
|
||||
self.assertIn(b"Sign in with KeyCape", html)
|
||||
|
||||
def test_metrics_expose_only_bounded_aggregate_state(self):
|
||||
denied, _ = invoke(self.app, "/metrics", claims={}, marker="")
|
||||
self.assertEqual("403 Forbidden", denied["status"])
|
||||
result, payload = invoke(self.app, "/metrics", claims={})
|
||||
self.assertEqual("200 OK", result["status"])
|
||||
self.assertEqual(
|
||||
"text/plain; version=0.0.4; charset=utf-8",
|
||||
result["headers"]["Content-Type"],
|
||||
)
|
||||
self.assertIn(b"user_engine_ready 1", payload)
|
||||
self.assertIn(b'user_engine_records{kind="users"} 0', payload)
|
||||
self.assertNotIn(SECRET.encode(), payload)
|
||||
|
||||
def test_protected_route_rejects_untrusted_claim_header(self):
|
||||
result, payload = invoke(
|
||||
self.app, "/api/v1/me", claims=self.claims, marker="attacker"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue