Skip to content

Commit

Permalink
fix flacky test with chambrousse
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilouf committed Jan 15, 2025
1 parent f43743a commit 79bab6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lemarche/tenders/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,8 @@ def sectors_list_string(self, display_max=3) -> str:
def sectors_full_list_string(self) -> str:
return self.sectors_list_string(display_max=None)

def perimeters_list(self):
return self.perimeters.values_list("name", flat=True)
def perimeters_list(self) -> list:
return list(self.perimeters.order_by("name").values_list("name", flat=True))

@cached_property
def perimeters_list_string(self) -> str:
Expand Down
6 changes: 4 additions & 2 deletions lemarche/tenders/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ def test_perimeters_list_property(self):
title="Besoin 3", perimeters=[self.grenoble_perimeter, self.chamrousse_perimeter]
)
self.assertEqual(len(tender_with_perimeters.perimeters_list()), 2)
self.assertEqual(tender_with_perimeters.perimeters_list()[0], self.grenoble_perimeter.name)
self.assertEqual(tender_with_perimeters.perimeters_list_string, "Grenoble, Chamrousse")
self.assertEqual(
tender_with_perimeters.perimeters_list(), [self.chamrousse_perimeter.name, self.grenoble_perimeter.name]
)
self.assertEqual(tender_with_perimeters.perimeters_list_string, "Chamrousse, Grenoble")

def test_location_display_property(self):
tender_country_area = TenderFactory(title="Besoin 1", is_country_area=True)
Expand Down

0 comments on commit 79bab6c

Please sign in to comment.