From 878b05b0ebf2ac6b3e336d06c81a6d9200e280d0 Mon Sep 17 00:00:00 2001 From: Antoine LAURENT Date: Thu, 11 Jul 2024 11:07:56 +0200 Subject: [PATCH] tests: Fix flaky test Don't set a pk ^ --- tests/gps/__snapshots__/test_views.ambr | 4 ++-- tests/gps/test_views.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/gps/__snapshots__/test_views.ambr b/tests/gps/__snapshots__/test_views.ambr index 615cd5c71d..6e96e315ec 100644 --- a/tests/gps/__snapshots__/test_views.ambr +++ b/tests/gps/__snapshots__/test_views.ambr @@ -233,7 +233,7 @@
- + Ne plus suivre @@ -248,7 +248,7 @@ - + Devenir référent diff --git a/tests/gps/test_views.py b/tests/gps/test_views.py index 0a9002b8aa..2874553d14 100644 --- a/tests/gps/test_views.py +++ b/tests/gps/test_views.py @@ -219,11 +219,17 @@ def test_my_groups(snapshot, client): # Nominal case # Groups created latelly should come first. - group = FollowUpGroupFactory(pk=34, memberships=1, for_snapshot=True) + group = FollowUpGroupFactory(memberships=1, for_snapshot=True) FollowUpGroup.objects.follow_beneficiary(beneficiary=group.beneficiary, user=user) response = client.get(reverse("gps:my_groups")) - groups = parse_response_to_soup(response, selector="#follow-up-groups-section").select(".membership-card") + groups = parse_response_to_soup( + response, + selector="#follow-up-groups-section", + replace_in_attr=[ + ("data-bs-confirm-url", f"/gps/groups/{group.pk}", "/gps/groups/[PK of Group]"), + ], + ).select(".membership-card") assert len(groups) == 2 assert str(groups[0]) == snapshot(name="test_my_groups__group_card")