mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-22 14:05:19 +02:00
Allow projects containing missing images to open in a degraded state instead of failing to load
This commit is contained in:
1 parent
de8e1039a9
commit
59a367b88d
8 files changed
+923
-18
No files matched your search
@@ -187,6 +187,44 @@ async def test_delete(project):
|
||||
compute2.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/3/ports/1/nio".format(project.id, node2.id), timeout=120)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_deferred_link_clears_local_references(project):
|
||||
node1 = Node(project, MagicMock(), "node1", node_type="vpcs")
|
||||
node1._ports = [EthernetPort("E0", 0, 0, 0)]
|
||||
node2 = Node(project, MagicMock(), "node2", node_type="vpcs")
|
||||
node2._ports = [EthernetPort("E0", 0, 0, 0)]
|
||||
link = UDPLink(project)
|
||||
|
||||
await link.add_node(node1, 0, 0, batch=True)
|
||||
await link.add_node(node2, 0, 0, batch=True)
|
||||
for entry in link._nodes:
|
||||
entry["node"].add_link(link)
|
||||
entry["port"].link = link
|
||||
link._deferred = True
|
||||
|
||||
await link.delete()
|
||||
|
||||
assert link not in node1.links
|
||||
assert link not in node2.links
|
||||
assert node1.get_port(0, 0).link is None
|
||||
assert node2.get_port(0, 0).link is None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_uncreated_non_deferred_link_preserves_existing_behavior(project):
|
||||
node = Node(project, MagicMock(), "node1", node_type="vpcs")
|
||||
node._ports = [EthernetPort("E0", 0, 0, 0)]
|
||||
link = UDPLink(project)
|
||||
await link.add_node(node, 0, 0, batch=True)
|
||||
node.add_link(link)
|
||||
node.get_port(0, 0).link = link
|
||||
|
||||
await link.delete()
|
||||
|
||||
assert link in node.links
|
||||
assert node.get_port(0, 0).link is link
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_reset(project):
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user