2016-03-17 15:15:30 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#
|
2020-06-16 13:59:03 +09:30
|
|
|
# Copyright (C) 2020 GNS3 Technologies Inc.
|
2016-03-17 15:15:30 +01:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2020-10-02 16:07:50 +09:30
|
|
|
import pytest
|
2016-03-17 15:15:30 +01:00
|
|
|
import json
|
|
|
|
|
2016-04-15 17:57:06 +02:00
|
|
|
from gns3server.compute.notification_manager import NotificationManager
|
2016-03-17 15:15:30 +01:00
|
|
|
|
|
|
|
|
2020-12-02 18:39:08 +10:30
|
|
|
# @pytest.mark.asyncio
|
|
|
|
# async def test_notification_ws(compute_api):
|
|
|
|
#
|
|
|
|
# # FIXME: how to test websockets
|
|
|
|
# pass
|
2020-11-11 17:18:41 +10:30
|
|
|
|
|
|
|
#with compute_api.ws("/notifications/ws") as ws:
|
|
|
|
|
|
|
|
# answer = await ws.receive_text()
|
|
|
|
# print(answer)
|
|
|
|
# answer = json.loads(answer)
|
|
|
|
#
|
|
|
|
# assert answer["action"] == "ping"
|
|
|
|
#
|
|
|
|
# NotificationManager.instance().emit("test", {})
|
|
|
|
#
|
|
|
|
# answer = await ws.receive_text()
|
|
|
|
# answer = json.loads(answer)
|
|
|
|
# assert answer["action"] == "test"
|