-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow username change, avoid new collisions on case insensitive match (…
…#2061) * allow username change, avoid new collisions on case insensitive match * fix existing profile edit test and test this feature * fix tests implicitly getting username from object * now a required field on user profile edit form
- Loading branch information
Showing
4 changed files
with
41 additions
and
5 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
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
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 |
---|---|---|
|
@@ -125,6 +125,7 @@ def test_unique_email(self): | |
User.objects.create_user('test42', '[email protected]', 'testpass') | ||
|
||
form = UserProfileForm({ | ||
'username': 'stanne', | ||
'email': '[email protected]', | ||
'search_visibility': 0, | ||
'email_privacy': 0, | ||
|
@@ -134,3 +135,19 @@ def test_unique_email(self): | |
form.errors, | ||
{'email': ['Please use a unique email address.']} | ||
) | ||
|
||
def test_case_insensitive_unique_username(self): | ||
User.objects.create_user('stanne', '[email protected]', 'testpass') | ||
User.objects.create_user('test42', '[email protected]', 'testpass') | ||
|
||
form = UserProfileForm({ | ||
'username': 'Test42', | ||
'email': '[email protected]', | ||
'search_visibility': 0, | ||
'email_privacy': 0, | ||
}, instance=User.objects.get(username='stanne')) | ||
self.assertFalse(form.is_valid()) | ||
self.assertEqual( | ||
form.errors, | ||
{'username': ['A user with that username already exists.']} | ||
) |
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