Send a email notification when a password was changed or reset #93588
@ -48,8 +48,22 @@ class PasswordChangedEmailTest(TestCase):
|
|||||||
new_password = get_random_string(16)
|
new_password = get_random_string(16)
|
||||||
response = self.client.get(password_reset_link)
|
response = self.client.get(password_reset_link)
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
submit_url = response['Location']
|
||||||
|
|
||||||
|
# mess up the input, don't get a notification
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
response['Location'],
|
submit_url,
|
||||||
|
{
|
||||||
|
'new_password1': new_password,
|
||||||
|
'new_password2': 'some other string',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertEqual(len(mail.outbox), 0)
|
||||||
|
|
||||||
|
# submit correctly, get a notification
|
||||||
|
response = self.client.post(
|
||||||
|
submit_url,
|
||||||
{
|
{
|
||||||
'new_password1': new_password,
|
'new_password1': new_password,
|
||||||
'new_password2': new_password,
|
'new_password2': new_password,
|
||||||
|
Loading…
Reference in New Issue
Block a user