mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-01 04:38:12 +00:00
Test link.updated event
This commit is contained in:
parent
54747ee618
commit
b00a09efaa
@ -99,7 +99,6 @@ class Link:
|
|||||||
self._capturing = False
|
self._capturing = False
|
||||||
self._project.controller.notification.emit("link.updated", self.__json__())
|
self._project.controller.notification.emit("link.updated", self.__json__())
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def read_pcap_from_source(self):
|
def read_pcap_from_source(self):
|
||||||
"""
|
"""
|
||||||
|
@ -117,3 +117,24 @@ def test_default_capture_file_name(project, compute, async_run):
|
|||||||
async_run(link.add_node(node1, 0, 4))
|
async_run(link.add_node(node1, 0, 4))
|
||||||
async_run(link.add_node(node2, 1, 3))
|
async_run(link.add_node(node2, 1, 3))
|
||||||
assert link.default_capture_file_name() == "Hello_0-4_to_w0rld_1-3.pcap"
|
assert link.default_capture_file_name() == "Hello_0-4_to_w0rld_1-3.pcap"
|
||||||
|
|
||||||
|
|
||||||
|
def test_start_capture(link, async_run, tmpdir, project, controller):
|
||||||
|
@asyncio.coroutine
|
||||||
|
def fake_reader():
|
||||||
|
return AsyncioBytesIO()
|
||||||
|
|
||||||
|
link.read_pcap_from_source = fake_reader
|
||||||
|
controller._notification = MagicMock()
|
||||||
|
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__())
|
||||||
|
|
||||||
|
|
||||||
|
def test_stop_capture(link, async_run, tmpdir, project, controller):
|
||||||
|
link._capturing = True
|
||||||
|
controller._notification = MagicMock()
|
||||||
|
async_run(link.stop_capture())
|
||||||
|
assert link._capturing is False
|
||||||
|
controller._notification.emit.assert_called_with("link.updated", link.__json__())
|
||||||
|
Loading…
Reference in New Issue
Block a user