mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
1 parent
d126db1fe9
commit
ed2e4e43f2
4 files changed
+23
-4
No files matched your search
@@ -74,6 +74,7 @@ def test_iou_create_with_params(server, project, base_params):
|
||||
params["ethernet_adapters"] = 0
|
||||
params["l1_keepalives"] = True
|
||||
params["initial_config_content"] = "hostname test"
|
||||
params["use_default_iou_values"] = True
|
||||
|
||||
response = server.post("/projects/{project_id}/iou/vms".format(project_id=project.id), params, example=True)
|
||||
assert response.status == 201
|
||||
@@ -85,6 +86,8 @@ def test_iou_create_with_params(server, project, base_params):
|
||||
assert response.json["ram"] == 1024
|
||||
assert response.json["nvram"] == 512
|
||||
assert response.json["l1_keepalives"] is True
|
||||
assert response.json["use_default_iou_values"] is True
|
||||
|
||||
assert "initial-config.cfg" in response.json["initial_config"]
|
||||
with open(initial_config_file(project, response.json)) as f:
|
||||
assert f.read() == params["initial_config_content"]
|
||||
@@ -140,7 +143,8 @@ def test_iou_update(server, vm, tmpdir, free_console_port, project):
|
||||
"ethernet_adapters": 4,
|
||||
"serial_adapters": 0,
|
||||
"l1_keepalives": True,
|
||||
"initial_config_content": "hostname test"
|
||||
"initial_config_content": "hostname test",
|
||||
"use_default_iou_values": True
|
||||
}
|
||||
response = server.put("/projects/{project_id}/iou/vms/{vm_id}".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), params, example=True)
|
||||
assert response.status == 200
|
||||
@@ -151,6 +155,7 @@ def test_iou_update(server, vm, tmpdir, free_console_port, project):
|
||||
assert response.json["ram"] == 512
|
||||
assert response.json["nvram"] == 2048
|
||||
assert response.json["l1_keepalives"] is True
|
||||
assert response.json["use_default_iou_values"] is True
|
||||
assert "initial-config.cfg" in response.json["initial_config"]
|
||||
with open(initial_config_file(project, response.json)) as f:
|
||||
assert f.read() == "hostname test"
|
||||
|
||||
@@ -36,12 +36,13 @@ def test_upload(server, tmpdir):
|
||||
with open(str(tmpdir / "test"), "w+") as f:
|
||||
f.write("TEST")
|
||||
body = aiohttp.FormData()
|
||||
body.add_field("type", "QEMU")
|
||||
body.add_field("file", open(str(tmpdir / "test"), "rb"), content_type="application/iou", filename="test2")
|
||||
|
||||
with patch("gns3server.config.Config.get_section_config", return_value={"images_path": str(tmpdir)}):
|
||||
response = server.post('/upload', api_version=None, body=body, raw=True)
|
||||
|
||||
with open(str(tmpdir / "test2")) as f:
|
||||
with open(str(tmpdir / "QEMU" / "test2")) as f:
|
||||
assert f.read() == "TEST"
|
||||
|
||||
assert "test2" in response.body.decode("utf-8")
|
||||
Reference in new issue
Block a user