mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
cleanup pending notifications
This commit is contained in:
@@ -11,6 +11,7 @@ from sqlalchemy.orm.exc import NoResultFound
|
||||
|
||||
from app import db
|
||||
from app.dao.notifications_dao import (
|
||||
dao_close_out_delivery_receipts,
|
||||
dao_create_notification,
|
||||
dao_delete_notifications_by_id,
|
||||
dao_get_last_notification_added_for_job_id,
|
||||
@@ -2026,6 +2027,23 @@ def test_update_delivery_receipts(mocker):
|
||||
assert "provider_response" in kwargs
|
||||
|
||||
|
||||
def test_close_out_delivery_receipts(mocker):
|
||||
mock_session = mocker.patch("app.dao.notifications_dao.db.session")
|
||||
mock_update = MagicMock()
|
||||
mock_where = MagicMock()
|
||||
mock_values = MagicMock()
|
||||
mock_update.where.return_value = mock_where
|
||||
mock_where.values.return_value = mock_values
|
||||
|
||||
mock_session.execute.return_value = None
|
||||
with patch("app.dao.notifications_dao.update", return_value=mock_update):
|
||||
dao_close_out_delivery_receipts()
|
||||
mock_update.where.assert_called_once()
|
||||
mock_where.values.assert_called_once()
|
||||
mock_session.execute.assert_called_once_with(mock_values)
|
||||
mock_session.commit.assert_called_once()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"created_at_utc,date_to_check,expected_count",
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user