From 2c5bb3f7140efd85edbd55d12c08c03e8931beac Mon Sep 17 00:00:00 2001 From: Mike Degatano Date: Thu, 25 Aug 2022 16:06:47 -0400 Subject: [PATCH] Fix suggestion test to be order agnostic (#3822) --- tests/api/test_resolution.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/api/test_resolution.py b/tests/api/test_resolution.py index 516266e4d..6fa37312b 100644 --- a/tests/api/test_resolution.py +++ b/tests/api/test_resolution.py @@ -153,7 +153,14 @@ async def test_api_resolution_suggestions_for_issue(coresys: CoreSys, api_client resp = await api_client.get(f"/resolution/issue/{corrupt_repo.uuid}/suggestions") result = await resp.json() - assert result["data"]["suggestions"][0]["uuid"] == execute_reset.uuid - assert result["data"]["suggestions"][0]["auto"] is True - assert result["data"]["suggestions"][1]["uuid"] == execute_remove.uuid - assert result["data"]["suggestions"][1]["auto"] is False + suggestion = [ + su for su in result["data"]["suggestions"] if su["uuid"] == execute_reset.uuid + ] + assert bool(suggestion) + assert suggestion[0]["auto"] is True + + suggestion = [ + su for su in result["data"]["suggestions"] if su["uuid"] == execute_remove.uuid + ] + assert bool(suggestion) + assert suggestion[0]["auto"] is False