mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
more tests
This commit is contained in:
@@ -14,6 +14,7 @@ from app.celery.scheduled_tasks import (
|
|||||||
check_job_status,
|
check_job_status,
|
||||||
delete_verify_codes,
|
delete_verify_codes,
|
||||||
expire_or_delete_invitations,
|
expire_or_delete_invitations,
|
||||||
|
process_delivery_receipts,
|
||||||
replay_created_notifications,
|
replay_created_notifications,
|
||||||
run_scheduled_jobs,
|
run_scheduled_jobs,
|
||||||
)
|
)
|
||||||
@@ -600,3 +601,27 @@ def test_batch_insert_with_malformed_notifications(mocker):
|
|||||||
|
|
||||||
rs.llen.assert_called_once_with("message_queue")
|
rs.llen.assert_called_once_with("message_queue")
|
||||||
rs.rpush.assert_not_called()
|
rs.rpush.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
|
def test_process_delivery_receipts_success(mocker):
|
||||||
|
dao_update_mock = mocker.patch(
|
||||||
|
"app.dao.notifications_dao.dao_update_delivery_receipts"
|
||||||
|
)
|
||||||
|
cloudwatch_mock = mocker.patch(
|
||||||
|
"app.clients.cloudwatch.aws_cloudwatch.AwsCloudwatchClient"
|
||||||
|
)
|
||||||
|
cloudwatch_mock.check_delivery_receipts.return_value = {range(2000), range(500)}
|
||||||
|
current_app_mock = mocker.patch("app.celery.scheduled_tasks.current_app")
|
||||||
|
current_app_mock.return_value = MagicMock()
|
||||||
|
processor = MagicMock()
|
||||||
|
processor.process_delivery_receipts = process_delivery_receipts
|
||||||
|
|
||||||
|
processor.process_delivery_receipts()
|
||||||
|
|
||||||
|
cloudwatch_mock.init_app.assert_called_once_with(current_app_mock)
|
||||||
|
cloudwatch_mock.check_delivery_receipts.assert_called_ocne()
|
||||||
|
|
||||||
|
assert dao_update_mock.call_count == 3
|
||||||
|
dao_update_mock.assert_any_call(list(range(1000)), True)
|
||||||
|
dao_update_mock.assert_any_call(list(range(1000, 2000)), True)
|
||||||
|
dao_update_mock.assert_any_call(list(range(500)), True)
|
||||||
|
|||||||
Reference in New Issue
Block a user