created dao to get notifications by references

This commit is contained in:
venusbb
2017-12-01 09:31:03 +00:00
parent f32051194d
commit a0fe5c6971
2 changed files with 20 additions and 1 deletions

View File

@@ -53,7 +53,8 @@ from app.dao.notifications_dao import (
is_delivery_slow_for_provider,
set_scheduled_notification_to_processed,
update_notification_status_by_id,
update_notification_status_by_reference
update_notification_status_by_reference,
dao_get_notifications_by_reference
)
from app.dao.services_dao import dao_update_service
@@ -2111,6 +2112,17 @@ def test_dao_update_notifications_by_reference_returns_zero_when_no_notification
assert updated_count == 0
def test_dao_get_notifications_by_reference(sample_template):
notification_0 = create_notification(template=sample_template, reference='noref')
notification_1 = create_notification(template=sample_template, reference='ref')
notification_2 = create_notification(template=sample_template, reference='ref')
noti = dao_get_notifications_by_reference(['ref'])
assert len(noti) == 2
assert noti[0].id in [notification_1.id, notification_2.id]
assert noti[1].id in [notification_1.id, notification_2.id]
def test_dao_create_notification_sms_sender_mapping(sample_notification):
sms_sender = create_service_sms_sender(service=sample_notification.service, sms_sender='123456')
dao_create_notification_sms_sender_mapping(notification_id=sample_notification.id,