'Tests that the registry API returns list of
public images sorted by name-size and size-name with ascending
sort direction.'

def test_get_index_sort_multiple_keys_one_sort_dir(self):

    uuid4_time = (timeutils.utcnow() + datetime.timedelta(seconds=10))
    uuid3_time = (uuid4_time + datetime.timedelta(seconds=5))
    UUID3 = _gen_uuid()
    extra_fixture = {'id': UUID3, 'status': 'active', 'visibility': 'public', 'disk_format': 'vhd', 'container_format': 'ovf', 'name': 'asdf', 'size': 19, 'checksum': None, 'created_at': None, 'updated_at': uuid3_time}
    db_api.image_create(self.context, extra_fixture)
    UUID4 = _gen_uuid()
    extra_fixture = {'id': UUID4, 'status': 'active', 'visibility': 'public', 'disk_format': 'vhd', 'container_format': 'ovf', 'name': 'xyz', 'size': 20, 'checksum': None, 'created_at': None, 'updated_at': uuid4_time}
    db_api.image_create(self.context, extra_fixture)
    UUID5 = _gen_uuid()
    extra_fixture = {'id': UUID5, 'status': 'active', 'visibility': 'public', 'disk_format': 'vhd', 'container_format': 'ovf', 'name': 'asdf', 'size': 20, 'checksum': None, 'created_at': None, 'updated_at': uuid4_time}
    db_api.image_create(self.context, extra_fixture)
    req = webob.Request.blank('/rpc')
    req.method = 'POST'
    cmd = [{'command': 'image_get_all', 'kwargs': {'sort_key': ['name', 'size'], 'sort_dir': ['asc']}}]
    req.body = jsonutils.dump_as_bytes(cmd)
    res = req.get_response(self.api)
    self.assertEqual(http.OK, res.status_int)
    res_dict = jsonutils.loads(res.body)[0]
    images = res_dict
    uuid_list = [UUID3, UUID5, UUID1, UUID2, UUID4]
    self._compare_images_and_uuids(uuid_list, images)
    cmd = [{'command': 'image_get_all', 'kwargs': {'sort_key': ['size', 'name'], 'sort_dir': ['asc']}}]
    req.body = jsonutils.dump_as_bytes(cmd)
    res = req.get_response(self.api)
    self.assertEqual(http.OK, res.status_int)
    res_dict = jsonutils.loads(res.body)[0]
    images = res_dict
    uuid_list = [UUID1, UUID3, UUID2, UUID5, UUID4]
    self._compare_images_and_uuids(uuid_list, images)
