Process responses for letters even after the notification has been deleted.

This will continue to update the notification history for letter notifications.
We currently have an issue where the responses to letters from the provider is taking a long time.
This is due to the manual nature of their process.
Updating the status of the letter will still work if the notification has been purged.

Also turned back on the purge letter notification scheduled task.
This commit is contained in:
Rebecca Law
2018-03-01 15:39:51 +00:00
parent a6de9142cf
commit c474b2312b
5 changed files with 60 additions and 14 deletions

View File

@@ -31,7 +31,8 @@ from app.dao.notifications_dao import (
update_notification_status_by_id,
update_notification_status_by_reference,
dao_get_notification_by_reference,
dao_get_notifications_by_references
dao_get_notifications_by_references,
dao_get_notification_history_by_reference,
)
from app.dao.services_dao import dao_update_service
from app.models import (
@@ -1998,6 +1999,30 @@ def test_dao_get_notifications_by_reference(sample_template):
assert notifications[1].id in [notification_1.id, notification_2.id]
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_history_by_reference('REF1')
assert notification.reference == 'REF1'
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_history_by_reference('REF1')
def test_dao_get_notification_history_by_reference_with_no_matches_raises_error(notify_db):
with pytest.raises(SQLAlchemyError):
dao_get_notification_history_by_reference('REF1')
@freeze_time("2017-12-18 17:50")
def test_dao_get_count_of_letters_to_process_for_today(sample_letter_template):
# expected