Revert "Scheduled weekly dependency update for week 16"

This commit is contained in:
Rebecca Law
2021-04-28 10:17:16 +01:00
committed by GitHub
parent 10b0554784
commit 85895a9e8b
14 changed files with 62 additions and 57 deletions

View File

@@ -79,7 +79,7 @@ def test_get_unknown_invited_user_returns_none(notify_db, notify_db_session, sam
with pytest.raises(NoResultFound) as e:
get_invited_user_by_service_and_id(sample_service.id, unknown_id)
assert 'No row was found when one was required' in str(e.value)
assert 'No row was found for one()' in str(e.value)
def test_get_invited_users_for_service(notify_db, notify_db_session, sample_service):

View File

@@ -509,7 +509,7 @@ def test_dao_fetch_live_services_data(sample_user):
def test_get_service_by_id_returns_none_if_no_service(notify_db):
with pytest.raises(NoResultFound) as e:
dao_fetch_service_by_id(str(uuid.uuid4()))
assert 'No row was found when one was required' in str(e.value)
assert 'No row was found for one()' in str(e.value)
def test_get_service_by_id_returns_service(notify_db_session):

View File

@@ -13,7 +13,12 @@ from app.dao.templates_dao import (
dao_update_template,
dao_update_template_reply_to,
)
from app.models import Template, TemplateHistory, TemplateRedacted
from app.models import (
Template,
TemplateFolder,
TemplateHistory,
TemplateRedacted,
)
from tests.app.db import create_letter_contact, create_template
@@ -90,6 +95,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')
@@ -338,7 +372,7 @@ def test_get_template_version_returns_none_for_hidden_templates(sample_service):
def test_get_template_by_id_and_service_returns_none_if_no_template(sample_service, fake_uuid):
with pytest.raises(NoResultFound) as e:
dao_get_template_by_id_and_service_id(template_id=fake_uuid, service_id=sample_service.id)
assert 'No row was found when one was required' in str(e.value)
assert 'No row was found for one' in str(e.value)
def test_create_template_creates_a_history_record_with_current_data(sample_service, sample_user):

View File

@@ -411,27 +411,6 @@ def test_should_be_able_to_archive_template(client, sample_template):
assert Template.query.first().archived
def test_should_be_able_to_archive_template_should_remove_template_folders(
client, sample_service
):
template_folder = create_template_folder(service=sample_service)
template = create_template(service=sample_service, folder=template_folder)
data = {
'archived': True,
}
client.post(
f'/service/{sample_service.id}/template/{template.id}',
headers=[('Content-Type', 'application/json'), create_authorization_header()],
data=json.dumps(data)
)
updated_template = Template.query.get(template.id)
assert updated_template.archived
assert not updated_template.folder
def test_get_precompiled_template_for_service(
client,
notify_user,