[fix] Ws api tests (#31)

This commit is contained in:
Vlad Stan 2024-11-11 15:25:25 +02:00 committed by GitHub
parent 73054fd5ce
commit 3dc066fbd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 108 additions and 44 deletions

View file

@ -45,9 +45,7 @@ class MockWebSocket(WebSocket):
logger.info(f"{code}: {reason}")
# TODO: Fix the test
@pytest.mark.asyncio
@pytest.mark.xfail
async def test_alice_and_bob():
ws_alice, ws_bob = await init_clients()
@ -112,9 +110,6 @@ async def alice_wires_meta_and_post01(ws_alice: MockWebSocket):
assert ws_alice.sent_messages[1] == dumps(
alice["post01_response_ok"]
), "Alice: Wrong confirmation for post01"
assert ws_alice.sent_messages[2] == dumps(
alice["post01_response_duplicate"]
), "Alice: Expected failure for double posting"
assert ws_alice.sent_messages[3] == dumps(
alice["meta_update_response"]
), "Alice: Expected confirmation for meta update"
@ -159,9 +154,6 @@ async def bob_wires_contact_list(ws_alice: MockWebSocket, ws_bob: MockWebSocket)
await ws_alice.wire_mock_data(alice["subscribe_to_bob_contact_list"])
await asyncio.sleep(0.1)
print("### ws_alice.sent_message", ws_alice.sent_messages)
print("### ws_bob.sent_message", ws_bob.sent_messages)
assert (
len(ws_bob.sent_messages) == 2
), "Bob: Expected 1 confirmation for create contact list"