mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-22 05:55:14 +02:00
The server has now 2 notification streams
* A new one for controller related events (compute, appliance templates etc.) * The existing one for project related events (links, nodes etc.)
This commit is contained in:
1 parent
dac3ba19b7
commit
7f72b90b0e
364 files changed
+12364
-9923
No files matched your search
@@ -68,7 +68,7 @@ def test_add_node(async_run, project, compute):
|
||||
|
||||
link = Link(project)
|
||||
link.create = AsyncioMagicMock()
|
||||
link._project.controller.notification.emit = MagicMock()
|
||||
link._project.controller.notification.project_emit = MagicMock()
|
||||
project.dump = AsyncioMagicMock()
|
||||
async_run(link.add_node(node1, 0, 4))
|
||||
assert link._nodes == [
|
||||
@@ -87,7 +87,7 @@ def test_add_node(async_run, project, compute):
|
||||
}
|
||||
]
|
||||
assert project.dump.called
|
||||
assert not link._project.controller.notification.emit.called
|
||||
assert not link._project.controller.notification.project_emit.called
|
||||
|
||||
assert not link.create.called
|
||||
|
||||
@@ -97,7 +97,7 @@ def test_add_node(async_run, project, compute):
|
||||
async_run(link.add_node(node2, 0, 4))
|
||||
|
||||
assert link.create.called
|
||||
link._project.controller.notification.emit.assert_called_with("link.created", link.__json__())
|
||||
link._project.controller.notification.project_emit.assert_called_with("link.created", link.__json__())
|
||||
assert link in node2.links
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ def test_add_node_already_connected(async_run, project, compute):
|
||||
|
||||
link = Link(project)
|
||||
link.create = AsyncioMagicMock()
|
||||
link._project.controller.notification.emit = MagicMock()
|
||||
link._project.controller.notification.project_emit = MagicMock()
|
||||
async_run(link.add_node(node1, 0, 4))
|
||||
node2 = Node(project, compute, "node2", node_type="qemu")
|
||||
node2._ports = [EthernetPort("E0", 0, 0, 4)]
|
||||
@@ -133,7 +133,7 @@ def test_add_node_cloud(async_run, project, compute):
|
||||
|
||||
link = Link(project)
|
||||
link.create = AsyncioMagicMock()
|
||||
link._project.controller.notification.emit = MagicMock()
|
||||
link._project.controller.notification.project_emit = MagicMock()
|
||||
|
||||
async_run(link.add_node(node1, 0, 4))
|
||||
async_run(link.add_node(node2, 0, 4))
|
||||
@@ -150,7 +150,7 @@ def test_add_node_cloud_to_cloud(async_run, project, compute):
|
||||
|
||||
link = Link(project)
|
||||
link.create = AsyncioMagicMock()
|
||||
link._project.controller.notification.emit = MagicMock()
|
||||
link._project.controller.notification.project_emit = MagicMock()
|
||||
|
||||
async_run(link.add_node(node1, 0, 4))
|
||||
with pytest.raises(aiohttp.web.HTTPConflict):
|
||||
@@ -166,7 +166,7 @@ def test_add_node_same_node(async_run, project, compute):
|
||||
|
||||
link = Link(project)
|
||||
link.create = AsyncioMagicMock()
|
||||
link._project.controller.notification.emit = MagicMock()
|
||||
link._project.controller.notification.project_emit = MagicMock()
|
||||
|
||||
async_run(link.add_node(node1, 0, 4))
|
||||
with pytest.raises(aiohttp.web.HTTPConflict):
|
||||
@@ -184,7 +184,7 @@ def test_add_node_serial_to_ethernet(async_run, project, compute):
|
||||
|
||||
link = Link(project)
|
||||
link.create = AsyncioMagicMock()
|
||||
link._project.controller.notification.emit = MagicMock()
|
||||
link._project.controller.notification.project_emit = MagicMock()
|
||||
|
||||
async_run(link.add_node(node1, 0, 4))
|
||||
with pytest.raises(aiohttp.web.HTTPConflict):
|
||||
@@ -323,7 +323,7 @@ def test_start_capture(link, async_run, tmpdir, project, controller):
|
||||
async_run(link.start_capture(capture_file_name="test.pcap"))
|
||||
assert link._capturing
|
||||
assert link._capture_file_name == "test.pcap"
|
||||
controller._notification.emit.assert_called_with("link.updated", link.__json__())
|
||||
controller._notification.project_emit.assert_called_with("link.updated", link.__json__())
|
||||
|
||||
|
||||
def test_stop_capture(link, async_run, tmpdir, project, controller):
|
||||
@@ -331,7 +331,7 @@ def test_stop_capture(link, async_run, tmpdir, project, controller):
|
||||
controller._notification = MagicMock()
|
||||
async_run(link.stop_capture())
|
||||
assert link._capturing is False
|
||||
controller._notification.emit.assert_called_with("link.updated", link.__json__())
|
||||
controller._notification.project_emit.assert_called_with("link.updated", link.__json__())
|
||||
|
||||
|
||||
def test_delete(async_run, project, compute):
|
||||
@@ -340,7 +340,7 @@ def test_delete(async_run, project, compute):
|
||||
|
||||
link = Link(project)
|
||||
link.create = AsyncioMagicMock()
|
||||
link._project.controller.notification.emit = MagicMock()
|
||||
link._project.controller.notification.project_emit = MagicMock()
|
||||
project.dump = AsyncioMagicMock()
|
||||
async_run(link.add_node(node1, 0, 4))
|
||||
|
||||
@@ -360,7 +360,7 @@ def test_update_filters(async_run, project, compute):
|
||||
|
||||
link = Link(project)
|
||||
link.create = AsyncioMagicMock()
|
||||
link._project.controller.notification.emit = MagicMock()
|
||||
link._project.controller.notification.project_emit = MagicMock()
|
||||
project.dump = AsyncioMagicMock()
|
||||
async_run(link.add_node(node1, 0, 4))
|
||||
|
||||
|
||||
Reference in new issue
Block a user