Add sorting to the "in list filter" test

Without this change, the result can be accurate but in the wrong order,
causing a failure like:

    AssertionError:
    Lists differ: ['greeting', 'farewell'] != ['farewell', 'greeting']

Change-Id: Ia0f3e9fa03834feb4c87c6ac50930a0d533a19bd
This commit is contained in:
Dougal Matthews 2018-11-13 09:29:10 +00:00
parent ec93acdafa
commit b63d95a524
1 changed files with 2 additions and 1 deletions

View File

@ -165,10 +165,11 @@ class ActionTestsV2(base.TestCase):
_, body = self.client.get_object('actions', created_acts[0]) _, body = self.client.get_object('actions', created_acts[0])
time = body['created_at'] time = body['created_at']
resp, body = self.client.get_list_obj( resp, body = self.client.get_list_obj(
'actions?created_at=in:' + time.replace(' ', '%20')) 'actions?sort_keys=name&created_at=in:' + time.replace(' ', '%20'))
self.assertEqual(200, resp.status) self.assertEqual(200, resp.status)
action_names = [action['name'] for action in body['actions']] action_names = [action['name'] for action in body['actions']]
created_acts.sort()
self.assertListEqual(created_acts, action_names) self.assertListEqual(created_acts, action_names)
@decorators.attr(type='smoke') @decorators.attr(type='smoke')