mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-12 17:10:55 +00:00
parent
8a6584d90f
commit
bfee08459d
@ -23,6 +23,7 @@ import json
|
|||||||
import uuid
|
import uuid
|
||||||
import sys
|
import sys
|
||||||
import io
|
import io
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
from ..utils import parse_version
|
from ..utils import parse_version
|
||||||
from ..utils.images import list_images
|
from ..utils.images import list_images
|
||||||
@ -602,7 +603,7 @@ class Compute:
|
|||||||
images.append(local_image)
|
images.append(local_image)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise ComputeError("Can't list images: {}".format(str(e)))
|
raise ComputeError("Can't list images: {}".format(str(e)))
|
||||||
images.sort()
|
images = sorted(images, key=itemgetter('filename'))
|
||||||
return images
|
return images
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
@ -360,8 +360,10 @@ def test_images(compute, async_run, images_dir):
|
|||||||
images = async_run(compute.images("qemu"))
|
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, timeout=None)
|
mock.assert_called_with("GET", "https://example.com:84/v2/compute/qemu/images", auth=None, data=None, headers={'content-type': 'application/json'}, chunked=False, timeout=None)
|
||||||
|
|
||||||
assert images == [{"filename": "linux.qcow2", "path": "linux.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0},
|
assert images == [
|
||||||
{"filename": "asa.qcow2", "path": "asa.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0}]
|
{"filename": "asa.qcow2", "path": "asa.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0},
|
||||||
|
{"filename": "linux.qcow2", "path": "linux.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_list_files(project, async_run, compute):
|
def test_list_files(project, async_run, compute):
|
||||||
|
Loading…
Reference in New Issue
Block a user