Allow adding broadcast templates

At the moment the page is the same as for text message templates,
except:
- different H1
- no guidance about personalisation, links, etc (until we decide how
  these should work)

For now you won’t be able to really create a broadcast template, because
the API doesn’t support it (the API will respond with a 400). But that’s
OK because no real services have the broadcast permission yet.

This required a bit of refactoring of how we check which template types
a service can use, because there were some hard-coded assumptions about
emails and text messages.
This commit is contained in:
Chris Hill-Scott
2020-07-01 16:43:08 +01:00
parent 8a1d86633c
commit 154d4bdb85
11 changed files with 175 additions and 77 deletions

View File

@@ -280,6 +280,7 @@ def test_should_not_allow_files_to_be_uploaded_without_the_correct_permission(
service_id=SERVICE_ONE_ID,
template_id=template_id,
_follow_redirects=True,
_expected_status=403,
)
assert page.select('main p')[0].text.strip() == "Sending text messages has been disabled for your service."
@@ -312,10 +313,12 @@ def test_example_spreadsheet(
def test_example_spreadsheet_for_letters(
client_request,
service_one,
mocker,
mock_get_service_letter_template_with_placeholders,
fake_uuid,
):
service_one['permissions'] += ['letter']
mocker.patch('app.main.views.send.get_page_count_for_letter', return_value=1)
page = client_request.get(
@@ -600,6 +603,7 @@ def test_upload_csv_file_with_bad_postal_address_shows_check_page_with_errors(
mock_get_jobs,
fake_uuid,
):
service_one['permissions'] += ['letter']
mocker.patch('app.main.views.send.get_page_count_for_letter', return_value=9)
mocker.patch(
'app.main.views.send.s3download',
@@ -658,7 +662,7 @@ def test_upload_csv_file_with_international_letters_permission_shows_appropriate
mock_get_jobs,
fake_uuid,
):
service_one['permissions'] += ['international_letters']
service_one['permissions'] += ['letter', 'international_letters']
mocker.patch('app.main.views.send.get_page_count_for_letter', return_value=9)
mocker.patch(
'app.main.views.send.s3download',
@@ -1328,6 +1332,7 @@ def test_send_one_off_does_not_send_without_the_correct_permissions(
service_id=SERVICE_ONE_ID,
template_id=template_id,
_follow_redirects=True,
_expected_status=403,
)
assert page.select('main p')[0].text.strip() == "Sending text messages has been disabled for your service."