mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
parent
c88c67e8ef
commit
ac24922300
@ -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]
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user