mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 14:31:13 +02:00
Merge branch '2.0' into 2.1
This commit is contained in:
37 files changed
+435
-70
No files matched your search
@@ -47,7 +47,7 @@ def test_query_success(loop, vm):
|
||||
vm._session.request = AsyncioMagicMock(return_value=response)
|
||||
data = loop.run_until_complete(asyncio.async(vm.query("POST", "test", data={"a": True}, params={"b": 1})))
|
||||
vm._session.request.assert_called_with('POST',
|
||||
'http://docker/test',
|
||||
'http://docker/v1.25/test',
|
||||
data='{"a": true}',
|
||||
headers={'content-type': 'application/json'},
|
||||
params={'b': 1},
|
||||
@@ -70,7 +70,7 @@ def test_query_error(loop, vm):
|
||||
with pytest.raises(DockerError):
|
||||
data = loop.run_until_complete(asyncio.async(vm.query("POST", "test", data={"a": True}, params={"b": 1})))
|
||||
vm._session.request.assert_called_with('POST',
|
||||
'http://docker/test',
|
||||
'http://docker/v1.25/test',
|
||||
data='{"a": true}',
|
||||
headers={'content-type': 'application/json'},
|
||||
params={'b': 1},
|
||||
@@ -91,7 +91,7 @@ def test_query_error_json(loop, vm):
|
||||
with pytest.raises(DockerError):
|
||||
data = loop.run_until_complete(asyncio.async(vm.query("POST", "test", data={"a": True}, params={"b": 1})))
|
||||
vm._session.request.assert_called_with('POST',
|
||||
'http://docker/test',
|
||||
'http://docker/v1.25/test',
|
||||
data='{"a": true}',
|
||||
headers={'content-type': 'application/json'},
|
||||
params={'b': 1},
|
||||
|
||||
@@ -154,6 +154,7 @@ def test_termination_callback(vm, async_run):
|
||||
assert event == vm
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||
def test_termination_callback_error(vm, tmpdir, async_run):
|
||||
|
||||
with open(str(tmpdir / "qemu.log"), "w+") as f:
|
||||
|
||||
@@ -219,18 +219,6 @@ def test_get_relative_image_path(qemu, tmpdir, config):
|
||||
assert qemu.get_relative_image_path(path5) == path5
|
||||
|
||||
|
||||
def test_get_relative_image_path_ova(qemu, tmpdir, config):
|
||||
os.makedirs(str(tmpdir / "QEMU" / "test.ova"))
|
||||
path = str(tmpdir / "QEMU" / "test.ova" / "test.bin")
|
||||
open(path, 'w+').close()
|
||||
|
||||
config.set_section_config("Server", {
|
||||
"images_path": str(tmpdir)
|
||||
})
|
||||
assert qemu.get_relative_image_path(path) == os.path.join("test.ova", "test.bin")
|
||||
assert qemu.get_relative_image_path(os.path.join("test.ova", "test.bin")) == os.path.join("test.ova", "test.bin")
|
||||
|
||||
|
||||
def test_list_images(loop, qemu, tmpdir):
|
||||
|
||||
fake_images = ["a.qcow2", "b.qcow2", ".blu.qcow2", "a.qcow2.md5sum"]
|
||||
@@ -262,7 +250,7 @@ def test_list_images_recursives(loop, qemu, tmpdir):
|
||||
assert loop.run_until_complete(qemu.list_images()) == [
|
||||
{"filename": "a.qcow2", "path": "a.qcow2", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1},
|
||||
{"filename": "b.qcow2", "path": "b.qcow2", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1},
|
||||
{"filename": "c.qcow2", "path": os.path.sep.join(["c", "c.qcow2"]), "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1}
|
||||
{"filename": "c.qcow2", "path": force_unix_path(os.path.sep.join(["c", "c.qcow2"])), "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1}
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user