-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebSocketsAccessGuardian and test fot it
- Loading branch information
Showing
5 changed files
with
62 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/tests/functional/tests_remove_registered_on_token_expiration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import asyncio | ||
import pytest | ||
|
||
pytestmark = [ | ||
pytest.mark.slow, | ||
] | ||
|
||
|
||
@pytest.fixture | ||
def set_storage_connections_expired(storage): | ||
def set_expired(): | ||
for _, websocket_meta in storage.registered_websockets.items(): | ||
websocket_meta.expiration_timestamp = 1000 # far in the past | ||
|
||
return set_expired | ||
|
||
|
||
async def test_expired_connections_removed_from_active_connections(ws_client_authenticated, ws_client_recv_decoded, set_storage_connections_expired): | ||
set_storage_connections_expired() | ||
await asyncio.sleep(1.1) # give enough time to validator to do its job | ||
|
||
received = await ws_client_recv_decoded(ws_client_authenticated) | ||
|
||
assert len(received) == 2 | ||
assert received["message_type"] == "ErrorResponse" | ||
assert received["errors"] == ["Token expired, user subscriptions disabled or removed"] |