set api_key to be the default namespace if the server returns no attributes

This commit is contained in:
Ashwin Bharambe 2025-03-19 20:36:58 -07:00
parent 2692d73d7d
commit 6762e3f911
2 changed files with 7 additions and 3 deletions

View file

@ -201,4 +201,6 @@ async def test_auth_middleware_no_attributes(mock_middleware, mock_scope):
await middleware(mock_scope, mock_receive, mock_send)
assert "user_attributes" in mock_scope
assert mock_scope["user_attributes"] == {}
attributes = mock_scope["user_attributes"]
assert "namespaces" in attributes
assert attributes["namespaces"] == ["test-api-key"]