diff --git a/tests/conftest.py b/tests/conftest.py index d94b4bc2..7311b7e6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -117,8 +117,8 @@ def images_dir(config): path = config.get_section_config("Server").get("images_path") os.makedirs(path, exist_ok=True) - os.makedirs(os.path.join(path, "QEMU")) - os.makedirs(os.path.join(path, "IOU")) + os.makedirs(os.path.join(path, "QEMU"), exist_ok=True) + os.makedirs(os.path.join(path, "IOU"), exist_ok=True) return path diff --git a/tests/handlers/api/compute/test_qemu.py b/tests/handlers/api/compute/test_qemu.py index 3c349797..45636af9 100644 --- a/tests/handlers/api/compute/test_qemu.py +++ b/tests/handlers/api/compute/test_qemu.py @@ -277,7 +277,8 @@ async def test_images(compute_api, fake_qemu_vm): response = await compute_api.get("/qemu/images") assert response.status == 200 - assert response.json == [{"filename": "linux载.img", "path": "linux载.img", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1}] + assert response.json == [{'filename': 'config.img', 'filesize': 1048576, 'md5sum': '0ab49056760ae1db6c25376446190b47', 'path': 'config.img'}, + {"filename": "linux载.img", "path": "linux载.img", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1}] async def test_upload_image(compute_api, tmpdir):