Skip to content

Commit 9ee84cc

Browse files
committed
fix(test): update monitor auth test for WS-safe router config
The router-level token_dep was intentionally removed (PR #2063) because it broke WebSocket upgrades. Update the structural test to assert the dependency is absent — auth is enforced by AuthGateMiddleware.
1 parent a94041c commit 9ee84cc

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

deploy/docker/tests/test_security_2026_04.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,17 @@ def test_traversal_validator_removed(self):
138138

139139
class TestMonitorAuthStructural(unittest.TestCase):
140140

141-
def test_monitor_router_has_auth(self):
141+
def test_monitor_router_has_no_http_only_dep(self):
142+
"""Router-level token_dep was removed because it is HTTP-only and broke
143+
the WebSocket upgrade on /monitor/ws. Auth is enforced by
144+
AuthGateMiddleware; destructive routes keep Depends(require_admin)."""
142145
with open(os.path.join(DEPLOY_DIR, "server.py")) as f:
143146
source = f.read()
144-
# Find the line with monitor_router
145147
for line in source.splitlines():
146148
if "monitor_router" in line and "include_router" in line:
147-
self.assertIn("dependencies=", line,
148-
"Monitor router must have dependencies=[Depends(token_dep)]")
149+
self.assertNotIn("dependencies=", line,
150+
"Monitor router must NOT have router-level token_dep "
151+
"(breaks WS); auth is enforced by AuthGateMiddleware")
149152
return
150153
self.fail("Could not find monitor_router include_router line")
151154

0 commit comments

Comments
 (0)