Make a helper function for generating templates

Having this stuff split across various points in `conftest.py` was
making my brain melt.

This way I feel like it’s easier to see the input/output of the test.
This commit is contained in:
Chris Hill-Scott
2018-11-12 12:39:14 +00:00
parent 10fe78bb31
commit 012b560673

View File

@@ -17,6 +17,14 @@ def _folder(name, folder_id=None, parent=None):
}
def _template(template_type, name):
return {
'id': str(uuid.uuid4()),
'name': name,
'template_type': template_type,
}
@pytest.mark.parametrize('parent_folder_id', [None, PARENT_FOLDER_ID])
def test_add_page_shows_option_for_folder(
client_request,
@@ -150,6 +158,14 @@ def test_should_show_templates_folder_page(
_folder('folder_one_two', parent=PARENT_FOLDER_ID),
_folder('folder_one_one', CHILD_FOLDER_ID, parent=PARENT_FOLDER_ID),
]
mock_get_service_templates.return_value = [
_template('sms', 'sms_template_one'),
_template('sms', 'sms_template_two'),
_template('email', 'email_template_one'),
_template('email', 'email_template_two'),
_template('letter', 'letter_template_one'),
_template('letter', 'letter_template_two'),
]
service_one['permissions'] += ['letter', 'edit_folders']