-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
15 additions
and
4 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 |
---|---|---|
|
@@ -28,7 +28,11 @@ | |
Template, | ||
) | ||
from app.utils import get_document_url | ||
from app.v2.errors import RateLimitError, TooManyRequestsError | ||
from app.v2.errors import ( | ||
RateLimitError, | ||
TooManyRequestsError, | ||
TrialServiceTooManyEmailRequestsError, | ||
) | ||
from tests import create_authorization_header | ||
from tests.app.conftest import ( | ||
create_sample_api_key, | ||
|
@@ -417,13 +421,14 @@ def test_should_block_api_call_if_over_day_limit_for_live_service(notify_db, not | |
def test_should_block_api_call_if_over_day_limit_for_restricted_service(notify_db, notify_db_session, notify_api, mocker): | ||
with notify_api.test_request_context(): | ||
with notify_api.test_client() as client: | ||
mocker.patch("app.celery.provider_tasks.deliver_sms.apply_async") | ||
mocker.patch("app.celery.provider_tasks.deliver_email.apply_async") | ||
mocker.patch( | ||
"app.notifications.validators.check_email_daily_limit", | ||
side_effect=TooManyRequestsError(1), | ||
side_effect=TrialServiceTooManyEmailRequestsError(1), | ||
) | ||
|
||
service = create_sample_service(notify_db, notify_db_session, limit=1, restricted=True) | ||
create_sample_service_safelist(notify_db, notify_db_session, service=service, email_address="[email protected]") | ||
email_template = create_sample_email_template(notify_db, notify_db_session, service=service) | ||
create_sample_notification( | ||
notify_db, | ||
|