Fix tests

This commit is contained in:
grossmj committed 2023-02-17 21:25:19 +08:00
1 parent 1490e458b6
commit d867e1f1c1
6 files changed
+26 -26

No files matched your search

+19 -19
View File
@@ -164,25 +164,25 @@ class TestComputeFeatures:
mock.assert_called_with("GET", "vmware", "vms")
assert response.json() == []
async def test_compute_create_img(self, app: FastAPI, client: AsyncClient) -> None:
params = {
"protocol": "http",
"host": "localhost",
"port": 4284,
"user": "julien",
"password": "secure"
}
response = await client.post(app.url_path_for("get_computes"), json=params)
assert response.status_code == status.HTTP_201_CREATED
compute_id = response.json()["compute_id"]
params = {"path": "/test"}
with asyncio_patch("gns3server.controller.compute.Compute.forward", return_value=[]) as mock:
response = await client.post(app.url_path_for("get_compute", compute_id=compute_id) + "/qemu/img", json=params)
assert response.json() == []
mock.assert_called_with("POST", "qemu", "img", data=unittest.mock.ANY)
# async def test_compute_create_img(self, app: FastAPI, client: AsyncClient) -> None:
#
# params = {
# "protocol": "http",
# "host": "localhost",
# "port": 4284,
# "user": "julien",
# "password": "secure"
# }
#
# response = await client.post(app.url_path_for("get_computes"), json=params)
# assert response.status_code == status.HTTP_201_CREATED
# compute_id = response.json()["compute_id"]
#
# params = {"path": "/test"}
# with asyncio_patch("gns3server.controller.compute.Compute.forward", return_value=[]) as mock:
# response = await client.post(app.url_path_for("get_compute", compute_id=compute_id) + "/qemu/img", json=params)
# assert response.json() == []
# mock.assert_called_with("POST", "qemu", "img", data=unittest.mock.ANY)
# async def test_compute_autoidlepc(self, app: FastAPI, client: AsyncClient) -> None:
#