Test that template history updates created by

This commit is contained in:
Chris Hill-Scott
2020-06-29 11:16:29 +01:00
parent a0a5cde15e
commit 02e5ff61a4

View File

@@ -340,8 +340,13 @@ def test_must_have_a_subject_on_an_email_or_letter_template(client, sample_user,
def test_update_should_update_a_template(client, sample_user): def test_update_should_update_a_template(client, sample_user):
service = create_service(service_permissions=[LETTER_TYPE]) service = create_service(service_permissions=[LETTER_TYPE])
template = create_template(service, template_type="letter", postage="second") template = create_template(service, template_type="letter", postage="second")
assert template.created_by == service.created_by
assert template.created_by != sample_user
data = { data = {
'content': 'my template has new content, swell!', 'content': 'my template has new content, swell!',
'created_by': str(sample_user.id), 'created_by': str(sample_user.id),
@@ -366,6 +371,14 @@ def test_update_should_update_a_template(client, sample_user):
assert update_json_resp['data']['template_type'] == template.template_type assert update_json_resp['data']['template_type'] == template.template_type
assert update_json_resp['data']['version'] == 2 assert update_json_resp['data']['version'] == 2
assert update_json_resp['data']['created_by'] == str(sample_user.id)
assert [
template.created_by_id for template in TemplateHistory.query.all()
] == [
service.created_by.id,
sample_user.id,
]
def test_should_be_able_to_archive_template(client, sample_template): def test_should_be_able_to_archive_template(client, sample_template):
data = { data = {