Verified Commit d0a962c8 authored by Baptiste Beauplat's avatar Baptiste Beauplat
Browse files

Add a test to cover invalid link case for email update

parent b87b4818
......@@ -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')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment