-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e706107
commit 4ebac61
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) |