Merge branch '2.0' into 2.1

This commit is contained in:
Julien Duponchelle committed 2017-03-07 11:16:05 +01:00
commit 6017ebbd97
335 files changed
+1000 -5777

No files matched your search

+14 -5
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",
+3 -3
View File
@@ -144,7 +144,7 @@ def test_termination_callback(vm, async_run):
vm.status = "started"
with NotificationManager.instance().queue() as queue:
vm._termination_callback(0)
async_run(vm._termination_callback(0))
assert vm.status == "stopped"
async_run(queue.get(0)) #  Ping
@@ -163,10 +163,10 @@ def test_termination_callback_error(vm, tmpdir, async_run):
vm._stdout_file = str(tmpdir / "qemu.log")
with NotificationManager.instance().queue() as queue:
vm._termination_callback(1)
async_run(vm._termination_callback(1))
assert vm.status == "stopped"
async_run(queue.get(0)) #  Ping
async_run(queue.get(0)) # Ping
(action, event, kwargs) = queue.get_nowait()
assert action == "node.updated"
+1 -1
View File
@@ -35,5 +35,5 @@ def test_version_output(http_compute):
def test_debug_output(http_compute):
response = http_compute.get('/debug', example=True)
response = http_compute.get('/debug')
assert response.status == 200