Skip to content

Commit

Permalink
feat: add priority test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon committed Nov 22, 2023
1 parent e706107 commit 4ebac61
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions event_routing_backends/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,19 @@ def test_get_user_by_id(self):
user = get_user(self.edx_user.id)

self.assertEqual(self.edx_user, user)

def test_get_user_priority(self):
"""Since the method can find users by id or username this checks that the user
found by id will be returned instead of the user found by username when a user's
username is the same as the id of another user.
Expected behavior:
- Returned user corresponds to the id.
"""
right_user = UserFactory.create(username='testing', email='[email protected]')
# Create user with the previous user id as username.
UserFactory.create(username=right_user.id, email='[email protected]')

user = get_user(right_user.id)

self.assertEqual(right_user, user)

0 comments on commit 4ebac61

Please sign in to comment.