Julien Duponchelle 7 years ago
parent 8a6584d90f
commit bfee08459d
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

@ -23,6 +23,7 @@ import json
import uuid
import sys
import io
from operator import itemgetter
from ..utils import parse_version
from ..utils.images import list_images
@ -602,7 +603,7 @@ class Compute:
images.append(local_image)
except OSError as e:
raise ComputeError("Can't list images: {}".format(str(e)))
images.sort()
images = sorted(images, key=itemgetter('filename'))
return images
@asyncio.coroutine

@ -360,8 +360,10 @@ def test_images(compute, async_run, images_dir):
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)
assert images == [{"filename": "linux.qcow2", "path": "linux.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0},
{"filename": "asa.qcow2", "path": "asa.qcow2", "md5sum": "d41d8cd98f00b204e9800998ecf8427e", "filesize": 0}]
assert images == [
{"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):

Loading…
Cancel
Save