mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-15 22:08:17 +00:00
Return md5sum and filesize in the list of images
Ref https://github.com/GNS3/gns3-gui/issues/1590
This commit is contained in:
@ -350,13 +350,18 @@ def test_images(compute, async_run, images_dir):
|
||||
"""
|
||||
response = MagicMock()
|
||||
response.status = 200
|
||||
response.read = AsyncioMagicMock(return_value=json.dumps([{"filename": "linux.qcow2", "path": "linux.qcow2"}]).encode())
|
||||
response.read = AsyncioMagicMock(return_value=json.dumps([{
|
||||
"filename": "linux.qcow2",
|
||||
"path": "linux.qcow2",
|
||||
"md5sum": "d41d8cd98f00b204e9800998ecf8427e",
|
||||
"filesize": 0}]).encode())
|
||||
open(os.path.join(images_dir, "asa.qcow2"), "w+").close()
|
||||
with asyncio_patch("aiohttp.ClientSession.request", return_value=response) as mock:
|
||||
images = async_run(compute.images("qemu"))
|
||||
mock.assert_called_with("GET", "https://example.com:84/v2/compute/qemu/images", auth=None, data=None, headers={'content-type': 'application/json'}, chunked=False)
|
||||
|
||||
assert images == [{"filename": "linux.qcow2", "path": "linux.qcow2"}, {"filename": "asa.qcow2", "path": "asa.qcow2"}]
|
||||
assert images == [{"filename": "linux.qcow2", "path": "linux.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0},
|
||||
{"filename": "asa.qcow2", "path": "asa.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0}]
|
||||
|
||||
|
||||
def test_list_files(project, async_run, compute):
|
||||
|
Reference in New Issue
Block a user