mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Remove alert for email / sms in created
In response to [1]. [1]: https://github.com/alphagov/notifications-api/pull/3383#discussion_r759379988 It turns out the code that inspired this new alert - in the old "timeout-sending-notifications" task - was actually redundant as we already have a task to "replay" notifications still in "created", which is much better than just alerting about them. It's possible the replayed notifications will also fail, but in both cases we should see some kind of error due to this, so I don't think we're losing anything by not having an alert.
This commit is contained in:
@@ -8,7 +8,6 @@ from sqlalchemy.exc import IntegrityError, SQLAlchemyError
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
|
||||
from app.dao.notifications_dao import (
|
||||
dao_check_notifications_still_in_created,
|
||||
dao_create_notification,
|
||||
dao_delete_notifications_by_id,
|
||||
dao_get_last_notification_added_for_job_id,
|
||||
@@ -665,33 +664,6 @@ def _notification_json(sample_template, job_id=None, id=None, status=None):
|
||||
return data
|
||||
|
||||
|
||||
def test_dao_check_notifications_still_in_created(
|
||||
sample_template,
|
||||
sample_email_template,
|
||||
sample_letter_template
|
||||
):
|
||||
with freeze_time(datetime.utcnow() - timedelta(minutes=2)):
|
||||
# old sending notification (ignored)
|
||||
create_notification(sample_template, status='sending')
|
||||
# old letter notification (ignored)
|
||||
create_notification(sample_letter_template, status='created')
|
||||
|
||||
with freeze_time(datetime.utcnow() + timedelta(minutes=10)):
|
||||
# new / future notification (ignored)
|
||||
create_notification(sample_template, status='created')
|
||||
|
||||
# first prove all the above notifications are ignored
|
||||
assert dao_check_notifications_still_in_created(1) == 0
|
||||
|
||||
with freeze_time(datetime.utcnow() - timedelta(minutes=2)):
|
||||
# now add old, eligible notifications
|
||||
create_notification(sample_template, status='created')
|
||||
create_notification(sample_email_template, status='created')
|
||||
|
||||
# now prove the check only picks up on these ones
|
||||
assert dao_check_notifications_still_in_created(1) == 2
|
||||
|
||||
|
||||
def test_dao_timeout_notifications(sample_template):
|
||||
with freeze_time(datetime.utcnow() - timedelta(minutes=2)):
|
||||
created = create_notification(sample_template, status='created')
|
||||
|
||||
Reference in New Issue
Block a user