OVA file support

This commit is contained in:
Julien Duponchelle committed 2015-10-06 17:50:54 +02:00
1 parent 034ac392b7
commit 3d7d8682ee
7 files changed
+102 -10

No files matched your search

+19
View File
@@ -232,6 +232,25 @@ def test_upload_vm(server, tmpdir):
assert checksum == "033bd94b1168d7e4f0d644c3c95e35bf"
def test_upload_vm_ova(server, tmpdir):
with patch("gns3server.modules.Qemu.get_images_directory", return_value=str(tmpdir),):
response = server.post("/qemu/vms/test2.ova/test2.vmdk", body="TEST", raw=True)
assert response.status == 204
with open(str(tmpdir / "test2.ova" / "test2.vmdk")) as f:
assert f.read() == "TEST"
with open(str(tmpdir / "test2.ova" / "test2.vmdk.md5sum")) as f:
checksum = f.read()
assert checksum == "033bd94b1168d7e4f0d644c3c95e35bf"
def test_upload_vm_forbiden_location(server, tmpdir):
with patch("gns3server.modules.Qemu.get_images_directory", return_value=str(tmpdir),):
response = server.post("/qemu/vms/../../test2", body="TEST", raw=True)
assert response.status == 403
def test_upload_vm_permission_denied(server, tmpdir):
with open(str(tmpdir / "test2"), "w+") as f:
f.write("")