Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
d0a962c8
Verified
Commit
d0a962c8
authored
Jan 06, 2022
by
Baptiste Beauplat
Browse files
Add a test to cover invalid link case for email update
parent
b87b4818
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/functional/accounts/test_update_email.py
View file @
d0a962c8
...
...
@@ -86,13 +86,16 @@ class TestUpdateEmail(TransactionTestController):
return
token
def
_submit_token
(
self
,
token
,
email
,
invalid
=
False
,
error
=
None
,
redirect
=
None
):
redirect
=
None
,
submit_data
=
None
):
if
not
submit_data
:
user
=
User
.
objects
.
get
(
email
=
self
.
_AUTHDATA
[
'username'
])
submit_data
=
{
'uidb64'
:
urlsafe_base64_encode
(
force_bytes
(
user
.
pk
)),
'token'
:
token
,
'email'
:
email
,
}
submit_url
=
reverse
(
'email_change_confirm'
,
kwargs
=
submit_data
)
response
=
self
.
client
.
get
(
submit_url
)
...
...
@@ -173,6 +176,16 @@ class TestUpdateEmail(TransactionTestController):
self
.
_submit_token
(
token
,
'new@example.org'
,
error
=
'address already exists'
)
def
test_update_email_invalid_taken
(
self
):
invalid_data
=
{
'uidb64'
:
'a'
,
'token'
:
'x-x'
,
'email'
:
'a'
,
}
self
.
_submit_token
(
None
,
'new@example.org'
,
invalid
=
True
,
submit_data
=
invalid_data
)
def
test_update_email_mismatch_email
(
self
):
token
=
self
.
_get_update_token
(
'new@example.org'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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