Enable show in file manager for cloud

Fix https://github.com/GNS3/gns3-gui/issues/1900
This commit is contained in:
Julien Duponchelle
2017-03-06 14:25:53 +01:00
parent 94d285301a
commit 8b7035b185
8 changed files with 27 additions and 12 deletions

View File

@ -29,21 +29,29 @@ def nio():
return NIOUDP(4242, "127.0.0.1", 4343)
def test_json_with_ports(on_gns3vm, project):
@pytest.fixture
def manager():
m = MagicMock()
m.module_name = "builtins"
return m
def test_json_with_ports(on_gns3vm, project, manager):
ports = [
{
"interface": "virbr0",
"name": "virbr0",
"port_number": 0,
"type": "ethernet"
"type": "ethernet",
}
]
cloud = Cloud("cloud1", str(uuid.uuid4()), project, MagicMock(), ports=ports)
cloud = Cloud("cloud1", str(uuid.uuid4()), project, manager, ports=ports)
assert cloud.__json__() == {
"name": "cloud1",
"node_id": cloud.id,
"project_id": project.id,
"status": "stopped",
"node_directory": cloud.working_dir,
"ports_mapping": [
{
"interface": "virbr0",
@ -60,16 +68,17 @@ def test_json_with_ports(on_gns3vm, project):
}
def test_json_without_ports(on_gns3vm, project):
def test_json_without_ports(on_gns3vm, project, manager):
"""
If no interface is provide the cloud is prefill with non special interfaces
"""
cloud = Cloud("cloud1", str(uuid.uuid4()), project, MagicMock(), ports=None)
cloud = Cloud("cloud1", str(uuid.uuid4()), project, manager, ports=None)
assert cloud.__json__() == {
"name": "cloud1",
"node_id": cloud.id,
"project_id": project.id,
"status": "stopped",
"node_directory": cloud.working_dir,
"ports_mapping": [
{
"interface": "eth0",