Merge branch 'master' into populate-monthly-letter-usages

This commit is contained in:
Rebecca Law
2017-12-15 14:26:39 +00:00
32 changed files with 508 additions and 38 deletions

View File

@@ -1,13 +1,15 @@
from app.models import (
Notification,
NOTIFICATION_CREATED,
NOTIFICATION_PENDING,
NOTIFICATION_SENDING,
KEY_TYPE_TEST,
KEY_TYPE_NORMAL
KEY_TYPE_NORMAL,
LETTER_TYPE
)
from app.dao.notifications_dao import dao_set_created_live_letter_api_notifications_to_pending
from tests.app.db import create_notification
from tests.app.db import create_notification, create_service, create_template
def test_should_only_get_letter_notifications(
@@ -23,6 +25,20 @@ def test_should_only_get_letter_notifications(
assert ret == [sample_letter_notification]
def test_should_ignore_letters_as_pdf(sample_letter_notification):
service = create_service(service_permissions=[LETTER_TYPE, 'letters_as_pdf'])
template = create_template(service, template_type=LETTER_TYPE)
create_notification(template)
all_noti = Notification.query.all()
assert len(all_noti) == 2
ret = dao_set_created_live_letter_api_notifications_to_pending()
assert sample_letter_notification.status == NOTIFICATION_PENDING
assert ret == [sample_letter_notification]
def test_should_only_get_created_letters(sample_letter_template):
created_noti = create_notification(sample_letter_template, status=NOTIFICATION_CREATED)
create_notification(sample_letter_template, status=NOTIFICATION_PENDING)