-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add testcase for testing password change notification
- Loading branch information
varun kumar
committed
Oct 15, 2023
1 parent
70be0c0
commit 591dc9e
Showing
4 changed files
with
38 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,3 +300,28 @@ def _create_user_and_login(self, usable_password=True): | |
def _password_set_or_change_redirect(self, urlname, usable_password): | ||
self._create_user_and_login(usable_password) | ||
return self.client.get(reverse(urlname)) | ||
|
||
|
||
def test_notification_on_password_reset(user_factory, client): | ||
user = user_factory( | ||
email="[email protected]", | ||
username="john.doe", | ||
password="password", | ||
commit=True, | ||
email_verified=True, | ||
) | ||
client.force_login(user) | ||
|
||
client.post( | ||
reverse("account_change_password"), | ||
data={ | ||
"oldpassword": "password", | ||
"password1": "change_password", | ||
"password2": "change_password", | ||
}, | ||
**{ | ||
"HTTP_USER_AGENT": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3" | ||
} | ||
) | ||
assert len(mail.outbox) == 1 | ||
assert "Your password has been changed" in mail.outbox[0].body |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{% extends "account/email/base_notification.txt" %} | ||
{% load i18n %} | ||
|
||
{% block content %}{% blocktrans %}Your password has been changed.{% endblocktrans %}{% endblock content %} | ||
{% block notification_message %}{% blocktrans %}Your password has been changed.{% endblocktrans %}{% endblock notification_message %} |