mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Merge branch 'master' into move-folders
This commit is contained in:
@@ -460,24 +460,24 @@ def test_create_nightly_notification_status(notify_db_session):
|
||||
create_notification(template=first_template, status='delivered')
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=1))
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=2))
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=3))
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=4))
|
||||
create_notification(template=first_template, status='delivered', created_at=datetime.utcnow() - timedelta(days=5))
|
||||
|
||||
create_notification(template=second_template, status='temporary-failure')
|
||||
create_notification(template=second_template, status='temporary-failure',
|
||||
created_at=datetime.utcnow() - timedelta(days=1))
|
||||
create_notification(template=second_template, status='temporary-failure',
|
||||
created_at=datetime.utcnow() - timedelta(days=2))
|
||||
create_notification(template=second_template, status='temporary-failure',
|
||||
created_at=datetime.utcnow() - timedelta(days=3))
|
||||
create_notification(template=second_template, status='temporary-failure',
|
||||
created_at=datetime.utcnow() - timedelta(days=4))
|
||||
create_notification(template=second_template, status='temporary-failure',
|
||||
created_at=datetime.utcnow() - timedelta(days=5))
|
||||
|
||||
create_notification(template=third_template, status='created')
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=1))
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=2))
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=3))
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=4))
|
||||
create_notification(template=third_template, status='created', created_at=datetime.utcnow() - timedelta(days=5))
|
||||
|
||||
assert len(FactNotificationStatus.query.all()) == 0
|
||||
|
||||
@@ -487,6 +487,6 @@ def test_create_nightly_notification_status(notify_db_session):
|
||||
FactNotificationStatus.notification_type
|
||||
).all()
|
||||
assert len(new_data) == 9
|
||||
assert str(new_data[0].bst_date) == datetime.strftime(datetime.utcnow() - timedelta(days=3), "%Y-%m-%d")
|
||||
assert str(new_data[0].bst_date) == datetime.strftime(datetime.utcnow() - timedelta(days=4), "%Y-%m-%d")
|
||||
assert str(new_data[3].bst_date) == datetime.strftime(datetime.utcnow() - timedelta(days=2), "%Y-%m-%d")
|
||||
assert str(new_data[6].bst_date) == datetime.strftime(datetime.utcnow() - timedelta(days=1), "%Y-%m-%d")
|
||||
|
||||
@@ -15,6 +15,7 @@ from app.dao.templates_dao import (
|
||||
)
|
||||
from app.models import (
|
||||
Template,
|
||||
TemplateFolder,
|
||||
TemplateHistory,
|
||||
TemplateRedacted
|
||||
)
|
||||
@@ -93,6 +94,35 @@ def test_update_template(sample_service, sample_user):
|
||||
assert dao_get_all_templates_for_service(sample_service.id)[0].name == 'new name'
|
||||
|
||||
|
||||
def test_update_template_in_a_folder_to_archived(sample_service, sample_user):
|
||||
template_data = {
|
||||
'name': 'Sample Template',
|
||||
'template_type': "sms",
|
||||
'content': "Template content",
|
||||
'service': sample_service,
|
||||
'created_by': sample_user
|
||||
}
|
||||
template = Template(**template_data)
|
||||
|
||||
template_folder_data = {
|
||||
'name': 'My Folder',
|
||||
'service_id': sample_service.id,
|
||||
}
|
||||
template_folder = TemplateFolder(**template_folder_data)
|
||||
|
||||
template.folder = template_folder
|
||||
dao_create_template(template)
|
||||
|
||||
template.archived = True
|
||||
dao_update_template(template)
|
||||
|
||||
template_folder = TemplateFolder.query.one()
|
||||
archived_template = Template.query.one()
|
||||
|
||||
assert template_folder
|
||||
assert not archived_template.folder
|
||||
|
||||
|
||||
def test_dao_update_template_reply_to_none_to_some(sample_service, sample_user):
|
||||
letter_contact = create_letter_contact(sample_service, 'Edinburgh, ED1 1AA')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user