From 7e5f441e320e5a465d39f00ea51aba4a1b802d03 Mon Sep 17 00:00:00 2001 From: ogeber <144006742+ogeber@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:52:59 +0100 Subject: [PATCH] (BSR)[API] fix: potentially flaky test --- api/tests/core/offers/test_repository.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/api/tests/core/offers/test_repository.py b/api/tests/core/offers/test_repository.py index c10919ec8f8..3782af9d990 100644 --- a/api/tests/core/offers/test_repository.py +++ b/api/tests/core/offers/test_repository.py @@ -2692,11 +2692,17 @@ def test_get_inactive_headline_offers_should_not_return_already_deactivated_head offer=another_inactive_offer, timespan=timespan_finishing_in_the_future, create_mediation=True ) - headline_offer_query_result = repository.get_inactive_headline_offers() - assert headline_offer_query_result == [ - inactive_offer_headline_offer, - headline_offer_finishing_in_the_future_but_offer_is_inactive, - ] + headline_offer_query_result = sorted( + repository.get_inactive_headline_offers(), key=lambda headline_offer: headline_offer.id + ) + + assert headline_offer_query_result == sorted( + [ + inactive_offer_headline_offer, + headline_offer_finishing_in_the_future_but_offer_is_inactive, + ], + key=lambda headline_offer: headline_offer.id, + ) def test_get_inactive_headline_offers_without_images(self): offer = factories.OfferFactory(isActive=True)