Method to return scheduled notifications that are ready to send

This commit is contained in:
Rebecca Law
2017-05-16 10:48:04 +01:00
parent a6529d2723
commit 579227dfc1
2 changed files with 18 additions and 2 deletions

View File

@@ -42,7 +42,7 @@ from app.dao.notifications_dao import (
is_delivery_slow_for_provider,
dao_update_notifications_sent_to_dvla,
dao_get_notifications_by_to_field,
dao_created_scheduled_notification)
dao_created_scheduled_notification, dao_get_scheduled_notifications)
from app.dao.services_dao import dao_update_service
from tests.app.db import create_notification
@@ -1704,3 +1704,13 @@ def test_dao_created_scheduled_notification(sample_notification):
assert len(saved_notification) == 1
assert saved_notification[0].notification_id == sample_notification.id
assert saved_notification[0].scheduled_for == datetime(2017, 1, 5, 14)
def test_dao_get_scheduled_notifications(notify_db, notify_db_session, sample_template):
notification_1 = sample_notification(notify_db=notify_db, notify_db_session=notify_db_session,
template=sample_template, scheduled_for='2017-05-05 14:00:00')
sample_notification(notify_db=notify_db, notify_db_session=notify_db_session,
template=sample_template)
scheduled_notifications = dao_get_scheduled_notifications()
assert len(scheduled_notifications) == 1
assert scheduled_notifications[0].notification_id == notification_1.id