Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ed7f32ee
Commit
ed7f32ee
authored
Oct 07, 2016
by
Edward Zarecor
Committed by
GitHub
Oct 07, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13678 from edx/e0d/ignore-email-case
comparison should be case-insensitive
parents
cf2c48ab
569e6745
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
common/djangoapps/student/management/commands/manage_user.py
+1
-1
common/djangoapps/student/management/tests/test_manage_user.py
+10
-0
No files found.
common/djangoapps/student/management/commands/manage_user.py
View file @
ed7f32ee
...
...
@@ -50,7 +50,7 @@ class Command(BaseCommand):
certain issues, for example if the expected username has already been
taken by someone else.
"""
if
user
.
email
!=
email
:
if
user
.
email
.
lower
()
!=
email
.
lower
()
:
# The passed email address doesn't match this username's email address.
# Assume a problem and fail.
raise
CommandError
(
...
...
common/djangoapps/student/management/tests/test_manage_user.py
View file @
ed7f32ee
...
...
@@ -117,6 +117,16 @@ class TestManageUserCommand(TestCase):
self
.
assertIn
(
'email addresses do not match'
,
str
(
exc_context
.
exception
)
.
lower
())
self
.
assertEqual
([(
TEST_USERNAME
,
TEST_EMAIL
)],
[(
u
.
username
,
u
.
email
)
for
u
in
User
.
objects
.
all
()])
def
test_same_email_varied_case
(
self
):
"""
Ensure that the operation continues if the username matches an
existing user account and the supplied email differs only in cases.
"""
User
.
objects
.
create
(
username
=
TEST_USERNAME
,
email
=
TEST_EMAIL
.
upper
())
call_command
(
'manage_user'
,
TEST_USERNAME
,
TEST_EMAIL
.
lower
())
user
=
User
.
objects
.
get
(
username
=
TEST_USERNAME
)
self
.
assertEqual
(
user
.
email
,
TEST_EMAIL
.
upper
())
@ddt.data
(
*
itertools
.
product
([(
True
,
True
),
(
True
,
False
),
(
False
,
True
),
(
False
,
False
)],
repeat
=
2
))
@ddt.unpack
def
test_bits
(
self
,
initial_bits
,
expected_bits
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment