Use create_template instead of sample_template in sample_notification

This commit is contained in:
Pea Tyczynska
2018-12-31 16:14:09 +00:00
parent 154257027f
commit cde30de100
4 changed files with 4 additions and 4 deletions

View File

@@ -552,7 +552,7 @@ def sample_notification(
if service is None:
service = create_service()
if template is None:
template = sample_template(notify_db, notify_db_session, service=service)
template = create_template(service=service)
if job is None and api_key is None:
# we didn't specify in test - lets create it

View File

@@ -22,7 +22,7 @@ from tests.app.db import (
def test_last_template_usage_should_get_right_data(sample_notification):
results = dao_get_last_template_usage(sample_notification.template_id, 'sms', sample_notification.service_id)
assert results.template.name == 'Template Name'
assert results.template.name == 'sms Template Name'
assert results.template.template_type == 'sms'
assert results.created_at == sample_notification.created_at
assert results.template_id == sample_notification.template_id

View File

@@ -153,7 +153,7 @@ def test_get_all_notifications(client, sample_notification):
assert notifications['notifications'][0]['to'] == '+447700900855'
assert notifications['notifications'][0]['service'] == str(sample_notification.service_id)
assert notifications['notifications'][0]['body'] == "This is a template:\nwith a newline"
assert notifications['notifications'][0]['body'] == 'Dear Sir/Madam, Hello. Yours Truly, The Government.'
def test_normal_api_key_returns_notifications_created_from_jobs_and_from_api(

View File

@@ -59,7 +59,7 @@ def test_get_template_statistics_for_service_by_day_returns_template_info(admin_
assert json_resp['data'][0]['count'] == 1
assert json_resp['data'][0]['template_id'] == str(sample_notification.template_id)
assert json_resp['data'][0]['template_name'] == 'Template Name'
assert json_resp['data'][0]['template_name'] == 'sms Template Name'
assert json_resp['data'][0]['template_type'] == 'sms'
assert json_resp['data'][0]['is_precompiled_letter'] is False