Test compute notifications and run tests on macOS and Windows.

This commit is contained in:
grossmj committed 2020-10-19 19:25:32 +10:30
1 parent 6af8c8933e
commit 596ee9b66d
4 files changed
+33 -36

No files matched your search

+15 -17
View File
@@ -21,20 +21,18 @@ import json
from gns3server.compute.notification_manager import NotificationManager
# @pytest.mark.asyncio
# async def test_notification_ws(compute_api, http_client):
#
# ws = await http_client.ws_connect(compute_api.get_url("/notifications/ws"))
# answer = await ws.receive()
# answer = json.loads(answer.data)
#
# assert answer["action"] == "ping"
#
# NotificationManager.instance().emit("test", {})
#
# answer = await ws.receive()
# answer = json.loads(answer.data)
# assert answer["action"] == "test"
#
# if not ws.closed:
# await ws.close()
@pytest.mark.asyncio
async def test_notification_ws(compute_api):
with compute_api.ws("/notifications/ws") as ws:
answer = ws.receive_text()
answer = json.loads(answer)
assert answer["action"] == "ping"
NotificationManager.instance().emit("test", {})
answer = ws.receive_text()
answer = json.loads(answer)
assert answer["action"] == "test"