Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Situphen committed Sep 21, 2024
1 parent da670d7 commit aef16e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion zds/member/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__in=[username])
already_existing.append((username, 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):
Expand Down

0 comments on commit aef16e7

Please sign in to comment.