Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
sastels committed Jun 4, 2024
1 parent 068cdae commit 77c6b8d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/app/celery/test_process_pinpoint_receipts_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@
)


@pytest.mark.parametrize("callback", [pinpoint_delivered_callback, pinpoint_shortcode_delivered_callback])
def test_process_pinpoint_results_delivered(sample_template, notify_db, notify_db_session, callback, mocker):
@pytest.mark.parametrize(
"callback, expected_response",
[
(pinpoint_delivered_callback, "Message has been accepted by phone"),
(pinpoint_shortcode_delivered_callback, "Message has been accepted by phone carrier"),
],
)
def test_process_pinpoint_results_delivered(sample_template, notify_db, notify_db_session, callback, expected_response, mocker):
mock_logger = mocker.patch("app.celery.process_pinpoint_receipts_tasks.current_app.logger.info")
mock_callback_task = mocker.patch("app.notifications.callbacks._check_and_queue_callback_task")

Expand All @@ -49,7 +55,7 @@ def test_process_pinpoint_results_delivered(sample_template, notify_db, notify_d

assert mock_callback_task.called_once_with(get_notification_by_id(notification.id))
assert get_notification_by_id(notification.id).status == NOTIFICATION_DELIVERED
assert get_notification_by_id(notification.id).provider_response == "Message has been accepted by phone"
assert get_notification_by_id(notification.id).provider_response == expected_response

mock_logger.assert_called_once_with(f"Pinpoint callback return status of delivered for notification: {notification.id}")

Expand Down

0 comments on commit 77c6b8d

Please sign in to comment.