-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove patch statement, minor fixes for consistenency
- Loading branch information
varun kumar
committed
Dec 16, 2023
1 parent
06d6c16
commit ba4dd0a
Showing
19 changed files
with
53 additions
and
74 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
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 |
---|---|---|
|
@@ -382,18 +382,14 @@ def test_confirm_logs_out_user(auth_client, settings, user, user_factory): | |
assert not auth_client.session.get(SESSION_KEY) | ||
|
||
|
||
@patch("allauth.account.app_settings.EMAIL_NOTIFICATIONS", True) | ||
def test_notification_on_email_remove(auth_client, user): | ||
def test_notification_on_email_remove(auth_client, user, settings, mailoutbox): | ||
settings.ACCOUNT_EMAIL_NOTIFICATIONS = True | ||
secondary = EmailAddress.objects.create( | ||
email="[email protected]", user=user, verified=False, primary=False | ||
) | ||
resp = auth_client.post( | ||
reverse("account_email"), | ||
{"action_remove": "", "email": secondary.email}, | ||
**{ | ||
"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" | ||
} | ||
reverse("account_email"), {"action_remove": "", "email": secondary.email} | ||
) | ||
assert resp.status_code == 302 | ||
assert len(mail.outbox) == 1 | ||
assert "Following email has been removed" in mail.outbox[0].body | ||
assert len(mailoutbox) == 1 | ||
assert "Following email has been removed" in mailoutbox[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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -297,8 +297,8 @@ def _create_user_and_login(self, usable_password=True): | |
return user | ||
|
||
|
||
@patch("allauth.account.app_settings.EMAIL_NOTIFICATIONS", True) | ||
def test_notification_on_password_change(user_factory, client): | ||
def test_notification_on_password_change(user_factory, client, settings, mailoutbox): | ||
settings.ACCOUNT_EMAIL_NOTIFICATIONS = True | ||
user = user_factory( | ||
email="[email protected]", | ||
password="password", | ||
|
@@ -313,33 +313,24 @@ def test_notification_on_password_change(user_factory, client): | |
"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 | ||
assert len(mailoutbox) == 1 | ||
assert "Your password has been changed" in mailoutbox[0].body | ||
|
||
|
||
@patch("allauth.account.app_settings.EMAIL_NOTIFICATIONS", True) | ||
def test_notification_on_password_reset(user_factory, client, settings): | ||
def test_notification_on_password_reset(user_factory, client, settings, mailoutbox): | ||
settings.ACCOUNT_EMAIL_NOTIFICATIONS = True | ||
user = user_factory( | ||
email="[email protected]", | ||
password="password", | ||
email_verified=True, | ||
) | ||
|
||
client.post(reverse("account_reset_password"), data={"email": user.email}) | ||
body = mail.outbox[0].body | ||
body = mailoutbox[0].body | ||
url = body[body.find("/password/reset/") :].split()[0] | ||
resp = client.get(url) | ||
resp = client.post( | ||
resp.url, | ||
{"password1": "newpass123", "password2": "newpass123"}, | ||
**{ | ||
"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" | ||
} | ||
) | ||
resp = client.post(resp.url, {"password1": "newpass123", "password2": "newpass123"}) | ||
|
||
assert len(mail.outbox) == 2 | ||
assert "Your password has been reset" in mail.outbox[1].body | ||
assert len(mailoutbox) == 2 | ||
assert "Your password has been reset" in mailoutbox[1].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
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
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
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
allauth/templates/mfa/email/recovery_codes_generated_message.txt
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% extends "account/email/base_notification.txt" %} | ||
{% load i18n %} | ||
|
||
{% block notification_message %}{% blocktrans %}Recovery codes has been generated.{% endblocktrans %}{% endblock notification_message %} |
4 changes: 4 additions & 0 deletions
4
allauth/templates/mfa/email/recovery_codes_generated_subject.txt
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}Recovery codes generated{% endblocktrans %} | ||
{% endautoescape %} |
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 notification_message %}{% blocktrans %}Totp has been activated.{% endblocktrans %}{% endblock notification_message %} | ||
{% block notification_message %}{% blocktrans %}Authenticator App has been activated.{% endblocktrans %}{% endblock notification_message %} |
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 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}Totp activated.{% endblocktrans %} | ||
{% blocktrans %}Authenticator App Activated{% endblocktrans %} | ||
{% endautoescape %} |
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 notification_message %}{% blocktrans %}Totp has been deactivated.{% endblocktrans %}{% endblock notification_message %} | ||
{% block notification_message %}{% blocktrans %}Authenticator App has been deactivated.{% endblocktrans %}{% endblock notification_message %} |
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 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}Totp deactivated{% endblocktrans %} | ||
{% blocktrans %}Authenticator App deactivated{% endblocktrans %} | ||
{% endautoescape %} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.