File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -1716,6 +1716,41 @@ def test_save_email_does_not_send_duplicate_and_does_not_put_in_retry_queue(
17161716 assert not retry .called
17171717
17181718
1719+ def test_save_email_twice_does_not_send_duplicate_and_does_not_put_in_retry_queue (
1720+ sample_email_notification , mocker , mock_celery_task
1721+ ):
1722+ json = _notification_json (
1723+ sample_email_notification .template ,
1724+ sample_email_notification .to ,
1725+ job_id = uuid .uuid4 (),
1726+ row_number = 1 ,
1727+ )
1728+ mock_task = mock_celery_task (provider_tasks .deliver_email )
1729+ retry = mocker .patch ("app.celery.tasks.save_email.retry" , side_effect = Exception ())
1730+
1731+ notification_id = sample_email_notification .id
1732+
1733+ save_email (
1734+ sample_email_notification .service_id ,
1735+ notification_id ,
1736+ signing .encode (json ),
1737+ )
1738+ save_email (
1739+ sample_email_notification .service_id ,
1740+ notification_id ,
1741+ signing .encode (json ),
1742+ )
1743+ save_email (
1744+ sample_email_notification .service_id ,
1745+ notification_id ,
1746+ signing .encode (json ),
1747+ )
1748+
1749+ assert Notification .query .count () == 1
1750+ assert not mock_task .called
1751+ assert not retry .called
1752+
1753+
17191754def test_save_sms_does_not_send_duplicate_and_does_not_put_in_retry_queue (
17201755 sample_notification , mocker , mock_celery_task
17211756):
You can’t perform that action at this time.
0 commit comments