1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Node deleted event

Fix #527
This commit is contained in:
Julien Duponchelle 2016-05-16 14:30:09 +02:00
parent c88c67e8ef
commit ac24922300
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 13 additions and 1 deletions

View File

@ -309,6 +309,7 @@ class BaseManager:
"""
node = yield from self.close_node(node_id)
node.project.emit("node.deleted", node)
node.project.mark_node_for_destruction(node)
if node.id in self._nodes:
del self._nodes[node.id]

View File

@ -193,3 +193,14 @@ def test_list_images_empty(loop, qemu, tmpdir):
def test_list_images_directory_not_exist(loop, qemu):
with patch("gns3server.compute.Qemu.get_images_directory", return_value="/bla"):
assert loop.run_until_complete(qemu.list_images()) == []
def test_delete_node(async_run, vpcs, project):
project._nodes = set()
node_id = str(uuid.uuid4())
node = async_run(vpcs.create_node("PC 1", project.id, node_id, console=2222))
assert node in project.nodes
with patch("gns3server.compute.project.Project.emit") as mock_emit:
async_run(vpcs.delete_node(node_id))
mock_emit.assert_called_with("node.deleted", node)
assert node not in project.nodes