From 07d5457049d231d2bc9b7014c883b2497942157e Mon Sep 17 00:00:00 2001 From: Situphen Date: Sat, 21 Sep 2024 23:47:11 +0200 Subject: [PATCH] test --- zds/member/api/tests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zds/member/api/tests.py b/zds/member/api/tests.py index b650c813c4..e380f1ccda 100644 --- a/zds/member/api/tests.py +++ b/zds/member/api/tests.py @@ -145,14 +145,17 @@ def test_search_with_results_in_right_order(self): Gets list of users corresponding to part of a username and verifies that the list of usernames returned is in the right order. """ + already_existing = [] for username in ("andr", "Radon", "alexandre", "MisterAndrew", "andré", "Andr", "dragon", "Andromède"): try: # in case this username has already been used by another test - Profile.objects.get(user__username=username) + p = Profile.objects.get(user__username=username) + already_existing.append(p) except Profile.DoesNotExist: ProfileFactory(user__username=username) response = self.client.get(reverse("api:member:list") + "?search=Andr") list_of_usernames = [item.get("username") for item in response.data.get("results")] + self.assertEqual(already_existing, []) self.assertEqual(list_of_usernames, ["Andr", "andr", "Andromède", "andré", "MisterAndrew", "alexandre"]) def test_register_new_user(self):