1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-24 15:58:08 +00:00

Fix tests.

This commit is contained in:
grossmj 2018-08-09 18:14:38 +07:00
parent 89f7169589
commit 652d5788c3
2 changed files with 7 additions and 4 deletions

View File

@ -122,6 +122,7 @@ def test_json(node, compute):
"compute_id": str(compute.id),
"project_id": node.project.id,
"node_id": node.id,
"appliance_id": None,
"node_type": node.node_type,
"name": "demo",
"console": node.console,
@ -157,6 +158,7 @@ def test_json(node, compute):
assert node.__json__(topology_dump=True) == {
"compute_id": str(compute.id),
"node_id": node.id,
"appliance_id": None,
"node_type": node.node_type,
"name": "demo",
"console": node.console,

View File

@ -18,6 +18,7 @@
import os
import sys
import uuid
import pytest
import aiohttp
import zipstream
@ -211,7 +212,7 @@ def test_add_node_from_appliance(async_run, controller):
compute.id = "local"
project = Project(controller=controller, name="Test")
controller._notification = MagicMock()
controller._appliances["fakeid"] = Appliance("fakeid", {
appliance = Appliance(str(uuid.uuid4()), {
"server": "local",
"name": "Test",
"default_name_format": "{name}-{0}",
@ -219,15 +220,15 @@ def test_add_node_from_appliance(async_run, controller):
"properties": {
"a": 1
}
})
controller._appliances[appliance.id] = appliance
controller._computes["local"] = compute
response = MagicMock()
response.json = {"console": 2048}
compute.post = AsyncioMagicMock(return_value=response)
node = async_run(project.add_node_from_appliance("fakeid", x=23, y=12))
node = async_run(project.add_node_from_appliance(appliance.id, x=23, y=12))
compute.post.assert_any_call('/projects', data={
"name": project._name,
@ -244,7 +245,7 @@ def test_add_node_from_appliance(async_run, controller):
controller.notification.emit.assert_any_call("node.created", node.__json__())
# Make sure we can call twice the node creation
node = async_run(project.add_node_from_appliance("fakeid", x=13, y=12))
node = async_run(project.add_node_from_appliance(appliance.id, x=13, y=12))
compute.post.assert_any_call('/projects/{}/vpcs/nodes'.format(project.id),
data={'node_id': node.id,
'name': 'Test-2',