From 5b4892250d60fbf0b134ac3a4d63deb127bf0cce Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Fri, 11 Nov 2016 15:13:28 -0500 Subject: [PATCH] fix partial test * We shouldn't care what order the inventory updates for the inventory sources are returned in. --- awx/main/tests/functional/test_partial.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/awx/main/tests/functional/test_partial.py b/awx/main/tests/functional/test_partial.py index 0ab84dc901..d0b3ec6fa2 100644 --- a/awx/main/tests/functional/test_partial.py +++ b/awx/main/tests/functional/test_partial.py @@ -101,8 +101,11 @@ class TestInventoryUpdateLatestDict(): inv_src2 = InventorySource.objects.create(group=g2, update_on_launch=False, inventory=inventory) inv_src3 = InventorySource.objects.create(group=g3, update_on_launch=True, inventory=inventory) + import time iu1 = InventoryUpdate.objects.create(inventory_source=inv_src1, status='successful') + time.sleep(0.1) iu2 = InventoryUpdate.objects.create(inventory_source=inv_src2, status='waiting') + time.sleep(0.1) iu3 = InventoryUpdate.objects.create(inventory_source=inv_src3, status='waiting') return [iu1, iu2, iu3] @@ -114,7 +117,7 @@ class TestInventoryUpdateLatestDict(): inventory_updates_expected = [inventory_updates[0], inventory_updates[2]] assert 2 == len(tasks) - for i, inventory_update in enumerate(inventory_updates_expected): - assert inventory_update.id == tasks[i]['id'] - + task_ids = [task['id'] for task in tasks] + for inventory_update in inventory_updates_expected: + inventory_update.id in task_ids