-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add domain to API flags blocked notification (#4574)
Co-authored-by: Matthew Elwell <[email protected]>
- Loading branch information
1 parent
b5c4615
commit dd1dd32
Showing
4 changed files
with
18 additions
and
6 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
2 changes: 1 addition & 1 deletion
2
api/organisations/templates/organisations/api_flags_blocked_notification.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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
from unittest.mock import MagicMock, call | ||
|
||
import pytest | ||
from core.helpers import get_current_site_url | ||
from django.core.mail.message import EmailMultiAlternatives | ||
from django.template.loader import render_to_string | ||
from django.utils import timezone | ||
|
@@ -1646,13 +1647,13 @@ def test_restrict_use_due_to_api_limit_grace_period_over( | |
assert email1.subject == "Flagsmith API use has been blocked due to overuse" | ||
assert email1.body == render_to_string( | ||
"organisations/api_flags_blocked_notification.txt", | ||
context={"organisation": organisation}, | ||
context={"organisation": organisation, "url": get_current_site_url()}, | ||
) | ||
email2 = mailoutbox[1] | ||
assert email2.subject == "Flagsmith API use has been blocked due to overuse" | ||
assert email2.body == render_to_string( | ||
"organisations/api_flags_blocked_notification.txt", | ||
context={"organisation": organisation2}, | ||
context={"organisation": organisation2, "url": get_current_site_url()}, | ||
) | ||
|
||
assert len(email2.alternatives) == 1 | ||
|
@@ -1661,7 +1662,11 @@ def test_restrict_use_due_to_api_limit_grace_period_over( | |
|
||
assert email2.alternatives[0][0] == render_to_string( | ||
"organisations/api_flags_blocked_notification.html", | ||
context={"organisation": organisation2, "grace_period": False}, | ||
context={ | ||
"organisation": organisation2, | ||
"grace_period": False, | ||
"url": get_current_site_url(), | ||
}, | ||
) | ||
assert email2.from_email == "[email protected]" | ||
assert email2.to == ["[email protected]", "[email protected]"] | ||
|
@@ -1674,7 +1679,11 @@ def test_restrict_use_due_to_api_limit_grace_period_over( | |
|
||
assert email3.alternatives[0][0] == render_to_string( | ||
"organisations/api_flags_blocked_notification.html", | ||
context={"organisation": organisation6, "grace_period": False}, | ||
context={ | ||
"organisation": organisation6, | ||
"grace_period": False, | ||
"url": get_current_site_url(), | ||
}, | ||
) | ||
assert email3.from_email == "[email protected]" | ||
assert email3.to == ["[email protected]", "[email protected]"] | ||
|