mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
clean up comments and method dupes
This commit is contained in:
@@ -191,7 +191,7 @@ def test_ses_callback_should_log_if_notification_is_missing(client, _notify_db,
|
||||
with freeze_time('2017-11-17T12:34:03.646Z'):
|
||||
assert process_ses_results(ses_notification_callback(reference='ref')) is None
|
||||
assert mock_retry.call_count == 0
|
||||
mock_logger.assert_called_once_with('notification not found for reference: ref (update to delivered)')
|
||||
mock_logger.assert_called_once_with('notification not found for reference: ref (while attempting update to delivered)')
|
||||
def test_ses_callback_should_not_retry_if_notification_is_old(client, _notify_db, mocker):
|
||||
mock_retry = mocker.patch('app.celery.process_ses_receipts_tasks.process_ses_results.retry')
|
||||
mock_logger = mocker.patch('app.celery.process_ses_receipts_tasks.current_app.logger.error')
|
||||
|
||||
@@ -146,16 +146,6 @@ def create_sample_notification(
|
||||
data["job_row_number"] = job_row_number
|
||||
notification = Notification(**data)
|
||||
dao_create_notification(notification)
|
||||
# if scheduled_for:
|
||||
# scheduled_notification = ScheduledNotification(
|
||||
# id=uuid.uuid4(),
|
||||
# notification_id=notification.id,
|
||||
# scheduled_for=datetime.strptime(scheduled_for, "%Y-%m-%d %H:%M"),
|
||||
# )
|
||||
# if status != "created":
|
||||
# scheduled_notification.pending = False
|
||||
# db.session.add(scheduled_notification)
|
||||
# db.session.commit()
|
||||
|
||||
return notification
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from app.dao.notifications_dao import (
|
||||
dao_get_letters_to_be_printed,
|
||||
dao_get_notification_by_reference,
|
||||
dao_get_notification_count_for_job_id,
|
||||
dao_get_notification_or_history_by_reference,
|
||||
dao_get_notification_history_by_reference,
|
||||
dao_get_notifications_by_recipient_or_reference,
|
||||
dao_timeout_notifications,
|
||||
dao_update_notification,
|
||||
@@ -1607,28 +1607,28 @@ def test_dao_get_notification_by_reference_with_no_matches_raises_error(notify_d
|
||||
dao_get_notification_by_reference('REF1')
|
||||
|
||||
|
||||
def test_dao_get_notification_or_history_by_reference_with_one_match_returns_notification(
|
||||
def test_dao_get_notification_history_by_reference_with_one_match_returns_notification(
|
||||
sample_letter_template
|
||||
):
|
||||
create_notification(template=sample_letter_template, reference='REF1')
|
||||
notification = dao_get_notification_or_history_by_reference('REF1')
|
||||
notification = dao_get_notification_history_by_reference('REF1')
|
||||
|
||||
assert notification.reference == 'REF1'
|
||||
|
||||
|
||||
def test_dao_get_notification_or_history_by_reference_with_multiple_matches_raises_error(
|
||||
def test_dao_get_notification_history_by_reference_with_multiple_matches_raises_error(
|
||||
sample_letter_template
|
||||
):
|
||||
create_notification(template=sample_letter_template, reference='REF1')
|
||||
create_notification(template=sample_letter_template, reference='REF1')
|
||||
|
||||
with pytest.raises(SQLAlchemyError):
|
||||
dao_get_notification_or_history_by_reference('REF1')
|
||||
dao_get_notification_history_by_reference('REF1')
|
||||
|
||||
|
||||
def test_dao_get_notification_or_history_by_reference_with_no_matches_raises_error(notify_db_session):
|
||||
def test_dao_get_notification_history_by_reference_with_no_matches_raises_error(notify_db_session):
|
||||
with pytest.raises(SQLAlchemyError):
|
||||
dao_get_notification_or_history_by_reference('REF1')
|
||||
dao_get_notification_history_by_reference('REF1')
|
||||
|
||||
|
||||
@pytest.mark.parametrize("notification_type",
|
||||
|
||||
Reference in New Issue
Block a user