-
- {% if logo %}
-
-

-
- {% endif %}
-
- Logos should be PNG files, 108px high
-
- {{ file_upload(form.file, allowed_file_extensions=['png'], button_text='{} logo'.format('Update' if email_branding else 'Upload')) }}
- {% call form_wrapper() %}
-
- {% endcall %}
-
-
-{% endblock %}
diff --git a/app/templates/views/email-branding/select-branding.html b/app/templates/views/email-branding/select-branding.html
deleted file mode 100644
index 5d0503f10..000000000
--- a/app/templates/views/email-branding/select-branding.html
+++ /dev/null
@@ -1,36 +0,0 @@
-{% extends "views/platform-admin/_base_template.html" %}
-{% from "components/page-header.html" import page_header %}
-{% from "components/live-search.html" import live_search %}
-{% from "components/components/button/macro.njk" import usaButton %}
-
-{% set page_title = "Email branding" %}
-
-{% block per_page_title %}
- {{ page_title }}
-{% endblock %}
-
-{% block platform_admin_content %}
-
-
{{ page_title }}
- {{ live_search(target_selector='.message-name', show=True, form=search_form, autofocus=True) }}
-
-
- {{ usaButton({
- "element": "a",
- "text": "New brand",
- "href": url_for('.create_email_branding'),
- "classes": "govuk-button--secondary"
- }) }}
-
-
-{% endblock %}
diff --git a/app/templates/views/features.html b/app/templates/views/features.html
index 244334f97..a981b86e0 100644
--- a/app/templates/views/features.html
+++ b/app/templates/views/features.html
@@ -13,7 +13,6 @@
If you work for the government, you can use Notify.gov to keep your users updated.
Notify makes it easy to create, customize, and send text messages.
You do not need any technical knowledge to use Notify.
diff --git a/app/templates/views/features/emails.html b/app/templates/views/features/emails.html
deleted file mode 100644
index 88731639f..000000000
--- a/app/templates/views/features/emails.html
+++ /dev/null
@@ -1,49 +0,0 @@
-{% extends "content_template.html" %}
-{% from "components/table.html" import mapping_table, row, text_field, edit_field, field with context %}
-
-{% block per_page_title %}
- Emails
-{% endblock %}
-
-{% block content_column_content %}
-
-
Emails
-
Send an unlimited number of emails for free with Notify.gov.
- {% if not current_user.is_authenticated %}
-
Create an account and try Notify for yourself.
- {% endif %}
-
-
Features
-
Notify makes it easy to:
-
- - create reusable email templates
- - personalize the content of your emails
- - send and schedule bulk messages
-
-
You can also integrate with our API to send emails automatically.
-
-
Email branding
-
Add your organization’s logo and brand color to email templates.
-
See how to change your email branding.
-
-
Send files by email
-
Notify offers a safe and reliable way to send files by email.
-
Upload a file using our API, then send your users an email with a link to download it.
-
Notify uses encrypted links instead of email attachments because:
-
- - they’re more secure
-
- - email attachments are often marked as spam
-
-
Read our API documentation for more information.
-
-
Add a reply-to address
-
Notify lets you choose the email address that users reply to.
-
Emails with a reply-to address seem more trustworthy and are less likely to be labelled as spam.
-
See how to add a reply-to address.
-
-
Pricing
-
It’s free to send emails through Notify.
-
See pricing for more details.
-
-{% endblock %}
diff --git a/app/templates/views/get-started.html b/app/templates/views/get-started.html
index 7b6ad500c..d4ad0ebce 100644
--- a/app/templates/views/get-started.html
+++ b/app/templates/views/get-started.html
@@ -34,10 +34,10 @@
Set up your service
{% if not current_user.is_authenticated or not current_service %}
- Review your settings to add message branding and sender information.
+ Review your settings to add message customization and sender information.
Add team members and check their permissions.
{% else %}
- Review your settings to add message branding and sender information.
+ Review your settings to add message customization and sender information.
Add team members and check their permissions.
{% endif %}
diff --git a/app/templates/views/guidance/branding-and-customisation.html b/app/templates/views/guidance/branding-and-customisation.html
deleted file mode 100644
index 2e3939a5b..000000000
--- a/app/templates/views/guidance/branding-and-customisation.html
+++ /dev/null
@@ -1,55 +0,0 @@
-{% extends "content_template.html" %}
-{% from "components/service-link.html" import service_link %}
-
-{% block per_page_title %}
- Branding and customization
-{% endblock %}
-
-{% block content_column_content %}
-
-
Branding and customization
-
-
-
-
Change the text message sender
-
-
The text message sender tells your users who the message is from.
-
-
To change the text message sender from the default of ‘Notify.gov’:
-
-
- - Go to the Text message settings section of the {{ service_link(current_service, 'main.service_settings', 'settings') }} page.
- - Select Manage on the Text message senders row.
- - Select Change or Add text message sender.
-
-
-{% endblock %}
diff --git a/app/templates/views/guidance/index.html b/app/templates/views/guidance/index.html
index e73cd5cd5..7d43f81c3 100644
--- a/app/templates/views/guidance/index.html
+++ b/app/templates/views/guidance/index.html
@@ -17,12 +17,12 @@
Edit and format messages
-
+
This section explains how to:
-
+
Format your content
-
+
You can see a list of formatting instructions on the edit template page:
-
+
- Go to the {{ service_link(current_service, 'main.choose_template', 'templates') }} page.
- Add a new template or choose an existing template and select Edit.
-
+
Add links
-
+
When composing a text message, write URLs in full and Notify will convert them into links for you.
-
+
You cannot convert text into a link.
-
+
We do not recommend using a third-party link shortening service because:
-
+
- your users cannot see where the link will take them
- your link might stop working if there’s a service outage
- you can no longer control where the redirect goes
-
+
Personalize your content
-
+
To personalize the content of your messages, add a placeholder to the template.
-
+
Placeholders are filled in with details, like a name or reference number, each time you send a
message.
-
+
To add a placeholder to the template:
-
+
- Go to the {{ service_link(current_service, 'main.choose_template', 'templates') }} page.
- Add a new template or choose an existing template and select Edit.
@@ -73,20 +73,20 @@
((ref number)).
- Select Save.
-
+
When you send a message you can either:
-
+
- manually fill in the placeholders yourself
- upload a list of personal details and let Notify do it for you
-
+
If you upload a list, the column names need to match the placeholders in your template.
-
+
Add optional content
-
+
To add optional content to your messages:
-
+
- Go to the {{ service_link(current_service, 'main.choose_template', 'templates') }} page.
- Add a new template or choose an existing template and select Edit.
@@ -94,25 +94,25 @@
who are under 18: ((under18??Please get your application signed by a parent or guardian.))
- Select Save.
-
+
For each person you send this message to, specify ‘yes’ or ‘no’ to show or hide this content. You
can either:
-
+
- do this yourself
- upload a list of personal details and let Notify do it for you
-
+
If you upload a list, the column names need to match the optional content in your template.
-
Branding and customization
-
+
Message customization
+
Change the text message sender
-
+
The text message sender tells your users who the message is from.
-
+
To change the text message sender from the default of ‘Notify.gov’:
-
+
- Go to the Text message settings section of the {{
service_link(current_service, 'main.service_settings', 'settings') }} page.
diff --git a/app/templates/views/organizations/organization/settings/index.html b/app/templates/views/organizations/organization/settings/index.html
index 50bee3109..a9d339bf8 100644
--- a/app/templates/views/organizations/organization/settings/index.html
+++ b/app/templates/views/organizations/organization/settings/index.html
@@ -67,16 +67,6 @@
}}
{% endcall %}
- {% call row() %}
- {{ text_field('Default email branding') }}
- {{ text_field(current_org.email_branding_name) }}
- {{ edit_field(
- 'Change',
- url_for('.edit_organization_email_branding', org_id=current_org.id),
- suffix='default email branding for the organization'
- )
- }}
- {% endcall %}
{% call row() %}
{{ text_field('Known email domains') }}
{{ optional_text_field(current_org.domains or None, default='None') }}
diff --git a/app/templates/views/organizations/organization/settings/preview-email-branding.html b/app/templates/views/organizations/organization/settings/preview-email-branding.html
deleted file mode 100644
index 45feae8c5..000000000
--- a/app/templates/views/organizations/organization/settings/preview-email-branding.html
+++ /dev/null
@@ -1,26 +0,0 @@
-{% extends "org_template.html" %}
-{% from "components/form.html" import form_wrapper %}
-{% from "components/components/button/macro.njk" import usaButton %}
-{% from "components/branding-preview.html" import email_branding_preview %}
-
-{% block org_page_title %}
- Preview email branding
-{% endblock %}
-
-{% block maincolumn_content %}
-
- Preview email branding
-
-
- {{ email_branding_preview(form.branding_style.data) }}
- {% call form_wrapper(action=action) %}
-
- {{ form.hidden_tag() }}
-
-
- {% endcall %}
-
-
-{% endblock %}
diff --git a/app/templates/views/organizations/organization/settings/set-email-branding.html b/app/templates/views/organizations/organization/settings/set-email-branding.html
deleted file mode 100644
index 30df51d10..000000000
--- a/app/templates/views/organizations/organization/settings/set-email-branding.html
+++ /dev/null
@@ -1,43 +0,0 @@
-{% extends "org_template.html" %}
-{% from "components/page-footer.html" import page_footer %}
-{% from "components/page-header.html" import page_header %}
-{% from "components/live-search.html" import live_search %}
-{% from "components/form.html" import form_wrapper %}
-{% from "components/components/back-link/macro.njk" import usaBackLink %}
-
-{% set page_title = "Default email branding" %}
-
-{% block per_page_title %}
- {{ page_title }}
-{% endblock %}
-
-{% block backLink %}
- {{ usaBackLink({ "href": url_for('.organization_settings', org_id=current_org.id) }) }}
-{% endblock %}
-
-{% block maincolumn_content %}
-
- {{ page_header(page_title) }}
- {% call form_wrapper(data_kwargs={'preview-type': 'email'}) %}
-
-
-
- {{ live_search(
- target_selector='.usa-radio',
- show=True,
- form=search_form,
- label='Search branding styles by name',
- autofocus=True
- ) }}
- {{ form.branding_style }}
-
-
-
- {{ page_footer('Preview') }}
-
- {% endcall %}
-
-{% endblock %}
diff --git a/app/templates/views/platform-admin/_base_template.html b/app/templates/views/platform-admin/_base_template.html
index 777d7b9bd..99d788dda 100644
--- a/app/templates/views/platform-admin/_base_template.html
+++ b/app/templates/views/platform-admin/_base_template.html
@@ -26,7 +26,6 @@
('Trial mode services', ('main.trial_services')),
('Organizations', ('main.organizations')),
('Reports', ('main.platform_admin_reports')),
- ('Email branding', ('main.email_branding')),
('Inbound SMS numbers', ('main.inbound_sms_admin')),
('Find services by name', ('main.find_services_by_name')),
('Find users by email', ('main.find_users_by_email')),
diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html
index a1dd3232e..86ef1a36d 100644
--- a/app/templates/views/service-settings.html
+++ b/app/templates/views/service-settings.html
@@ -162,23 +162,6 @@
}}
{% endcall %}
- {% if email_branding_options.something_else_is_only_option %}
- {% set email_request_url = url_for('.email_branding_something_else', service_id=current_service.id) %}
- {% else %}
- {% set email_request_url = url_for('.email_branding_request', service_id=current_service.id) %}
- {% endif %}
-
- {% call settings_row(if_has_permission='email') %}
- {{ text_field('Email branding') }}
- {{ text_field(current_service.email_branding_name) }}
- {{ edit_field(
- 'Change',
- email_request_url,
- permissions=['manage_service'],
- suffix='email branding',
- )}}
- {% endcall %}
-
{% call settings_row(if_has_permission='email') %}
{{ text_field('Send files by email') }}
{{ optional_text_field(current_service.contact_link, default="Not set up", truncate=true) }}
@@ -303,11 +286,6 @@
{{ text_field('{:,} per year'.format(current_service.free_sms_fragment_limit)) }}
{{ edit_field('Change', url_for('.set_free_sms_allowance', service_id=current_service.id), suffix='free text message allowance') }}
{% endcall %}
- {% call row() %}
- {{ text_field('Email branding' )}}
- {{ text_field(current_service.email_branding_name) }}
- {{ edit_field('Change', url_for('.service_set_email_branding', service_id=current_service.id), suffix='email branding (admin view)') }}
- {% endcall %}
{% call row() %}
{{ text_field('Custom data retention')}}
{% call field() %}
diff --git a/app/templates/views/service-settings/branding/email-branding-govuk-org.html b/app/templates/views/service-settings/branding/email-branding-govuk-org.html
deleted file mode 100644
index ba3043073..000000000
--- a/app/templates/views/service-settings/branding/email-branding-govuk-org.html
+++ /dev/null
@@ -1,36 +0,0 @@
-{% extends "withnav_template.html" %}
-{% from "components/form.html" import form_wrapper %}
-{% from "components/components/back-link/macro.njk" import usaBackLink %}
-{% from "components/page-footer.html" import page_footer %}
-{% from "components/page-header.html" import page_header %}
-
-{% block service_page_title %}
- Before you request new branding
-{% endblock %}
-
-{% block backLink %}
- {{ usaBackLink({
- "href": url_for('.email_branding_request', service_id=current_service.id)
- }) }}
-{% endblock %}
-
-{% block maincolumn_content %}
-
- {{ page_header('Before you request new branding') }}
-
- You can only use Notify.gov branding if people go to Notify.gov to access your service.
-
-
- You cannot use Notify.gov branding if your organization is
- independent
- from government.
-
-
- We’ll email you once your branding’s ready to use, or if we need any more information.
-
- {% call form_wrapper() %}
- {{ page_footer('Request new branding') }}
- {% endcall %}
-
-{% endblock %}
diff --git a/app/templates/views/service-settings/branding/email-branding-govuk.html b/app/templates/views/service-settings/branding/email-branding-govuk.html
deleted file mode 100644
index e58231326..000000000
--- a/app/templates/views/service-settings/branding/email-branding-govuk.html
+++ /dev/null
@@ -1,43 +0,0 @@
-{% extends "withnav_template.html" %}
-{% from "components/form.html" import form_wrapper %}
-{% from "components/components/back-link/macro.njk" import usaBackLink %}
-{% from "components/page-footer.html" import page_footer %}
-{% from "components/page-header.html" import page_header %}
-{% from "components/branding-preview.html" import email_branding_preview %}
-
-{% block service_page_title %}
- Check your new branding
-{% endblock %}
-
-{% block backLink %}
- {{ usaBackLink({
- "href": url_for('.email_branding_request', service_id=current_service.id)
- }) }}
-{% endblock %}
-
-{% block maincolumn_content %}
-
- {{ page_header('Check your new branding') }}
-
-
- Emails from {{ current_service.name }} will look like this.
-
-
- {{ email_branding_preview('__NONE__') }}
-
- Before you continue
-
- You can only use Notify.gov branding if people go to Notify.gov to access your service.
-
-
- You cannot use Notify.gov branding if your organization is
- independent
- from government.
-
-
- {% call form_wrapper() %}
- {{ page_footer('Use this branding') }}
- {% endcall %}
-
-{% endblock %}
diff --git a/app/templates/views/service-settings/branding/email-branding-options.html b/app/templates/views/service-settings/branding/email-branding-options.html
deleted file mode 100644
index acaf348b0..000000000
--- a/app/templates/views/service-settings/branding/email-branding-options.html
+++ /dev/null
@@ -1,48 +0,0 @@
-{% extends "withnav_template.html" %}
-{% from "components/radios.html" import radio %}
-{% from "components/select-input.html" import select_wrapper %}
-{% from "components/textbox.html" import textbox %}
-{% from "components/page-header.html" import page_header %}
-{% from "components/page-footer.html" import page_footer %}
-{% from "components/form.html" import form_wrapper %}
-{% from "components/components/back-link/macro.njk" import usaBackLink %}
-{% from "components/branding-preview.html" import email_branding_preview %}
-
-{% block service_page_title %}
- Change email branding
-{% endblock %}
-
-{% block backLink %}
- {{ usaBackLink({
- "href": url_for('.service_settings', service_id=current_service.id)
- }) }}
-{% endblock %}
-
-{% block maincolumn_content %}
-
- {{ page_header('Change email branding') }}
-
-
- Your emails currently have {{ branding_name }} branding.
-
-
- {{ email_branding_preview(
- current_service.email_branding_id if current_service.email_branding else '__NONE__'
- ) }}
-
- {% if current_service.needs_to_change_email_branding %}
-
- You should be using your own branding instead.
-
- {% endif %}
-
- {% call form_wrapper() %}
- {% call select_wrapper(form.options) %}
- {% for option in form.options %}
- {{ radio(option) }}
- {% endfor %}
- {% endcall %}
- {{ page_footer('Continue') }}
- {% endcall %}
-
-{% endblock %}
diff --git a/app/templates/views/service-settings/branding/email-branding-organization.html b/app/templates/views/service-settings/branding/email-branding-organization.html
deleted file mode 100644
index 83b6eb8c2..000000000
--- a/app/templates/views/service-settings/branding/email-branding-organization.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{% extends "withnav_template.html" %}
-{% from "components/form.html" import form_wrapper %}
-{% from "components/components/back-link/macro.njk" import usaBackLink %}
-{% from "components/page-footer.html" import page_footer %}
-{% from "components/page-header.html" import page_header %}
-
-{% block service_page_title %}
- When you request new branding
-{% endblock %}
-
-{% block backLink %}
- {{ usaBackLink({
- "href": url_for('.email_branding_request', service_id=current_service.id)
- }) }}
-{% endblock %}
-
-{% block maincolumn_content %}
-
- {{ page_header('When you request new branding') }}
-
- We’ll check if we already have the {{organization}} logo.
-
- If we do, we’ll let you know when your new branding is ready to use.
-
- If we don’t, we’ll email you to ask for more information.
-
- {% call form_wrapper() %}
- {{ page_footer('Request new branding') }}
- {% endcall %}
-
-{% endblock %}
diff --git a/app/templates/views/service-settings/branding/email-branding-something-else.html b/app/templates/views/service-settings/branding/email-branding-something-else.html
deleted file mode 100644
index bd61df811..000000000
--- a/app/templates/views/service-settings/branding/email-branding-something-else.html
+++ /dev/null
@@ -1,30 +0,0 @@
-{% extends "withnav_template.html" %}
-{% from "components/form.html" import form_wrapper %}
-{% from "components/components/back-link/macro.njk" import usaBackLink %}
-{% from "components/page-footer.html" import page_footer %}
-{% from "components/textbox.html" import textbox %}
-{% from "components/components/textarea/macro.njk" import govukTextarea %}
-
-{% block service_page_title %}
- Describe the branding you want
-{% endblock %}
-
-{% if branding_options.something_else_is_only_option %}
- {% set back_url = url_for('.service_settings', service_id=current_service.id) %}
-{% else %}
- {% set back_url = url_for('.email_branding_request', service_id=current_service.id) %}
-{% endif %}
-
-{% block backLink %}
- {{ usaBackLink({"href": back_url}) }}
-{% endblock %}
-
-{% block maincolumn_content %}
-
- {% call form_wrapper() %}
- {{ form.something_else }}
- We’ll email you when your branding is ready, or if we need any more information.
- {{ page_footer('Request new branding') }}
- {% endcall %}
-
-{% endblock %}
diff --git a/app/templates/views/service-settings/preview-email-branding.html b/app/templates/views/service-settings/preview-email-branding.html
deleted file mode 100644
index c575f4acc..000000000
--- a/app/templates/views/service-settings/preview-email-branding.html
+++ /dev/null
@@ -1,26 +0,0 @@
-{% extends "withnav_template.html" %}
-{% from "components/form.html" import form_wrapper %}
-{% from "components/components/button/macro.njk" import usaButton %}
-{% from "components/branding-preview.html" import email_branding_preview %}
-
-{% block service_page_title %}
- Preview email branding
-{% endblock %}
-
-{% block maincolumn_content %}
-
- Preview email branding
-
-
- {{ email_branding_preview(form.branding_style.data) }}
- {% call form_wrapper(action=action) %}
-
- {{ form.hidden_tag() }}
-
-
- {% endcall %}
-
-
-{% endblock %}
diff --git a/app/templates/views/service-settings/set-email-branding.html b/app/templates/views/service-settings/set-email-branding.html
deleted file mode 100644
index 131e8d73a..000000000
--- a/app/templates/views/service-settings/set-email-branding.html
+++ /dev/null
@@ -1,41 +0,0 @@
-{% extends "withnav_template.html" %}
-{% from "components/page-header.html" import page_header %}
-{% from "components/page-footer.html" import page_footer, sticky_page_footer %}
-{% from "components/live-search.html" import live_search %}
-{% from "components/form.html" import form_wrapper %}
-{% from "components/components/back-link/macro.njk" import usaBackLink %}
-
-{% set page_title = "Set email branding" %}
-
-{% block backLink %}
- {{ usaBackLink({ "href": url_for('.service_settings', service_id=current_service.id) }) }}
-{% endblock %}
-
-{% block service_page_title %}
- {{ page_title }}
-{% endblock %}
-
-{% block maincolumn_content %}
-
- {{ page_header(page_title) }}
- {% call form_wrapper(data_kwargs={'preview-type': 'email'}) %}
-
-
-
- {{ live_search(
- target_selector='.usa-radio',
- show=True,
- form=search_form,
- label='Search branding styles by name',
- autofocus=True
- ) }}
- {{ form.branding_style }}
-
-
- {{ sticky_page_footer('Preview') }}
- {% endcall %}
-
-{% endblock %}
diff --git a/app/templates/views/using-notify.html b/app/templates/views/using-notify.html
index 7d2701777..3b11fa271 100644
--- a/app/templates/views/using-notify.html
+++ b/app/templates/views/using-notify.html
@@ -21,7 +21,6 @@
diff --git a/app/utils/branding.py b/app/utils/branding.py
deleted file mode 100644
index dd35fea30..000000000
--- a/app/utils/branding.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from app.models.organization import Organization
-
-
-def get_email_choices(service):
- organization_branding_id = (
- service.organization.email_branding_id if service.organization else None
- )
-
- if (
- service.organization_type == Organization.TYPE_FEDERAL
- and service.email_branding_id is not None # GOV.UK is not current branding
- and organization_branding_id is None # no default to supersede it (GOV.UK)
- ):
- yield ("govuk", "GOV.UK")
-
- if (
- service.organization_type == Organization.TYPE_FEDERAL
- and service.organization
- and organization_branding_id is None # don't offer both if org has default
- and service.email_branding_name.lower()
- != f"GOV.UK and {service.organization.name}".lower()
- ):
- yield ("govuk_and_org", f"GOV.UK and {service.organization.name}")
diff --git a/gulpfile.js b/gulpfile.js
index 541c39cf4..9c0b34265 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -117,7 +117,6 @@ const javascripts = () => {
paths.src + 'javascripts/errorTracking.js',
paths.src + 'javascripts/preventDuplicateFormSubmissions.js',
paths.src + 'javascripts/fullscreenTable.js',
- paths.src + 'javascripts/previewPane.js',
paths.src + 'javascripts/colourPreview.js',
paths.src + 'javascripts/templateFolderForm.js',
paths.src + 'javascripts/collapsibleCheckboxes.js',
diff --git a/paas-failwhale/static_503/stylesheets/main.css b/paas-failwhale/static_503/stylesheets/main.css
index 92ac258b8..50a467879 100644
--- a/paas-failwhale/static_503/stylesheets/main.css
+++ b/paas-failwhale/static_503/stylesheets/main.css
@@ -8903,14 +8903,6 @@ only screen and (min-resolution: 2dppx) {
padding-bottom: 75%
}
-.branding-preview {
- width: 100%;
- box-sizing: border-box;
- border: solid 1px #bfc1c3;
- min-height: 200px;
- margin-bottom: 30px
-}
-
#logo-img {
background-color: #f8f8f8;
background-image: linear-gradient(45deg, #dee0e2 25%, transparent 25%), linear-gradient(-45deg, #dee0e2 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #dee0e2 75%), linear-gradient(-45deg, transparent 75%, #dee0e2 75%);
@@ -9444,56 +9436,6 @@ only screen and (min-resolution: 2dppx) {
position: relative
}
-.edit-template-link-letter-contact,
-.edit-template-link-letter-address,
-.edit-template-link-letter-body,
-.edit-template-link-letter-branding,
-.edit-template-link {
- font-family: "nta", Arial, sans-serif;
- font-weight: 400;
- text-transform: none;
- font-size: 16px;
- line-height: 1.25;
- position: absolute;
- background: #005ea5;
- color: #fff;
- padding: 10px 15px;
- z-index: 10000
-}
-
-@media (min-width: 641px) {
-
- .edit-template-link-letter-contact,
- .edit-template-link-letter-address,
- .edit-template-link-letter-body,
- .edit-template-link-letter-branding,
- .edit-template-link {
- font-size: 19px;
- line-height: 1.31579
- }
-}
-
-.edit-template-link-letter-contact:link,
-.edit-template-link-letter-address:link,
-.edit-template-link-letter-body:link,
-.edit-template-link-letter-branding:link,
-.edit-template-link-letter-contact:visited,
-.edit-template-link-letter-address:visited,
-.edit-template-link-letter-body:visited,
-.edit-template-link-letter-branding:visited,
-.edit-template-link:link,
-.edit-template-link:visited {
- color: #fff
-}
-
-.edit-template-link-letter-contact:hover,
-.edit-template-link-letter-address:hover,
-.edit-template-link-letter-body:hover,
-.edit-template-link-letter-branding:hover,
-.edit-template-link:hover {
- color: #d5e8f3
-}
-
.notification-status {
font-family: "nta", Arial, sans-serif;
font-weight: 400;
@@ -9817,4 +9759,4 @@ details .arrow {
.heading-upcoming-jobs {
margin-top: 15px
-}
\ No newline at end of file
+}
diff --git a/tests/app/main/views/organizations/test_organizations.py b/tests/app/main/views/organizations/test_organizations.py
index 0b330b5a9..440e8252a 100644
--- a/tests/app/main/views/organizations/test_organizations.py
+++ b/tests/app/main/views/organizations/test_organizations.py
@@ -931,7 +931,6 @@ def test_organization_settings_for_platform_admin(
"Request to go live notes None Change go live notes for the organization",
"Billing details None Change billing details for the organization",
"Notes None Change the notes for the organization",
- "Default email branding GOV.UK Change default email branding for the organization",
"Known email domains None Change known email domains for the organization",
]
diff --git a/tests/app/main/views/service_settings/test_email_branding_requests.py b/tests/app/main/views/service_settings/test_email_branding_requests.py
deleted file mode 100644
index ccab8a87a..000000000
--- a/tests/app/main/views/service_settings/test_email_branding_requests.py
+++ /dev/null
@@ -1,519 +0,0 @@
-from unittest.mock import ANY, PropertyMock
-
-import pytest
-from flask import url_for
-from notifications_utils.clients.zendesk.zendesk_client import NotifySupportTicket
-
-from tests import sample_uuid
-from tests.conftest import ORGANISATION_ID, SERVICE_ONE_ID, normalize_spaces
-
-
-@pytest.mark.parametrize(
- ("organization_type", "expected_options"),
- [
- (
- "other",
- [
- ("something_else", "Something else"),
- ],
- ),
- ],
-)
-def test_email_branding_request_page_when_no_branding_is_set(
- service_one,
- client_request,
- mocker,
- mock_get_email_branding,
- organization_type,
- expected_options,
-):
- service_one["email_branding"] = None
- service_one["organization_type"] = organization_type
-
- mocker.patch(
- "app.models.service.Service.email_branding_id",
- new_callable=PropertyMock,
- return_value=None,
- )
-
- page = client_request.get(".email_branding_request", service_id=SERVICE_ONE_ID)
-
- assert mock_get_email_branding.called is False
- assert page.find_all("iframe")[1]["src"] == url_for(
- "main.email_template", branding_style="__NONE__"
- )
-
- button_text = normalize_spaces(page.select_one(".page-footer button").text)
-
- assert [
- (
- radio["value"],
- page.select_one("label[for={}]".format(radio["id"])).text.strip(),
- )
- for radio in page.select("input[type=radio]")
- ] == expected_options
-
- assert button_text == "Continue"
-
-
-def test_email_branding_request_page_shows_branding_if_set(
- mocker,
- service_one,
- client_request,
- mock_get_email_branding,
- mock_get_service_organization,
-):
- mocker.patch(
- "app.models.service.Service.email_branding_id",
- new_callable=PropertyMock,
- return_value="some-random-branding",
- )
-
- page = client_request.get(".email_branding_request", service_id=SERVICE_ONE_ID)
- assert page.find_all("iframe")[1]["src"] == url_for(
- "main.email_template", branding_style="some-random-branding"
- )
-
-
-def test_email_branding_request_page_back_link(
- client_request,
-):
- page = client_request.get(".email_branding_request", service_id=SERVICE_ONE_ID)
-
- back_link = page.select_one("a.usa-back-link")
- assert len(back_link) > 0, "No back link found on the page"
- assert back_link["href"] == url_for(".service_settings", service_id=SERVICE_ONE_ID)
-
-
-@pytest.mark.parametrize(
- ("data", "org_type", "endpoint"),
- [
- (
- {
- "options": "govuk",
- },
- "federal",
- "main.email_branding_govuk",
- ),
- (
- {
- "options": "govuk_and_org",
- },
- "federal",
- "main.email_branding_govuk_and_org",
- ),
- (
- {
- "options": "something_else",
- },
- "federal",
- "main.email_branding_something_else",
- ),
- ],
-)
-def test_email_branding_request_submit(
- client_request,
- service_one,
- mocker,
- mock_get_email_branding,
- organization_one,
- data,
- org_type,
- endpoint,
-):
- organization_one["organization_type"] = org_type
- service_one["email_branding"] = sample_uuid()
- service_one["organization"] = organization_one
-
- mocker.patch(
- "app.organizations_client.get_organization",
- return_value=organization_one,
- )
-
- client_request.post(
- ".email_branding_request",
- service_id=SERVICE_ONE_ID,
- _data=data,
- _expected_status=302,
- _expected_redirect=url_for(
- endpoint,
- service_id=SERVICE_ONE_ID,
- ),
- )
-
-
-def test_email_branding_request_submit_when_no_radio_button_is_selected(
- client_request,
- service_one,
- mock_get_email_branding,
-):
- service_one["email_branding"] = sample_uuid()
-
- page = client_request.post(
- ".email_branding_request",
- service_id=SERVICE_ONE_ID,
- _data={"options": ""},
- _follow_redirects=True,
- )
- assert page.h1.text == "Change email branding"
- assert (
- normalize_spaces(page.select_one(".error-message").text) == "Select an option"
- )
-
-
-@pytest.mark.parametrize(
- ("endpoint", "expected_heading"),
- [
- ("main.email_branding_govuk_and_org", "Before you request new branding"),
- ],
-)
-def test_email_branding_description_pages_for_org_branding(
- client_request,
- mocker,
- service_one,
- organization_one,
- mock_get_email_branding,
- endpoint,
- expected_heading,
-):
- service_one["email_branding"] = sample_uuid()
- service_one["organization"] = organization_one
-
- mocker.patch(
- "app.organizations_client.get_organization",
- return_value=organization_one,
- )
-
- page = client_request.get(
- endpoint,
- service_id=SERVICE_ONE_ID,
- )
- assert page.h1.text == expected_heading
- assert (
- normalize_spaces(page.select_one(".page-footer button").text)
- == "Request new branding"
- )
-
-
-@pytest.mark.parametrize(
- ("endpoint", "service_org_type", "branding_preview_id"),
- [("main.email_branding_govuk", "central", "__NONE__")],
-)
-@pytest.mark.skip(reason="Update for TTS")
-def test_email_branding_govuk_and_nhs_pages(
- client_request,
- mocker,
- service_one,
- organization_one,
- mock_get_email_branding,
- endpoint,
- service_org_type,
- branding_preview_id,
-):
- organization_one["organization_type"] = service_org_type
- service_one["email_branding"] = sample_uuid()
- service_one["organization"] = organization_one
-
- mocker.patch(
- "app.organizations_client.get_organization",
- return_value=organization_one,
- )
-
- page = client_request.get(
- endpoint,
- service_id=SERVICE_ONE_ID,
- )
- assert page.h1.text == "Check your new branding"
- assert "Emails from service one will look like this" in normalize_spaces(page.text)
- assert page.find("iframe")["src"] == url_for(
- "main.email_template", branding_style=branding_preview_id
- )
- assert (
- normalize_spaces(page.select_one(".page-footer button").text)
- == "Use this branding"
- )
-
-
-@pytest.mark.skip(reason="Update for TTS")
-def test_email_branding_something_else_page(client_request, service_one):
- # expect to have a "NHS" option as well as the
- # fallback, so back button goes to choices page
- service_one["organization_type"] = "nhs_central"
-
- page = client_request.get(
- "main.email_branding_something_else",
- service_id=SERVICE_ONE_ID,
- )
- assert normalize_spaces(page.h1.text) == "Describe the branding you want"
- assert page.select_one("textarea")["name"] == ("something_else")
- assert (
- normalize_spaces(page.select_one(".page-footer button").text)
- == "Request new branding"
- )
- assert page.select_one(".usa-back-link")["href"] == url_for(
- "main.email_branding_request",
- service_id=SERVICE_ONE_ID,
- )
-
-
-def test_get_email_branding_something_else_page_is_only_option(
- client_request, service_one
-):
- # should only have a "something else" option
- # so back button goes back to settings page
- service_one["organization_type"] = "other"
-
- page = client_request.get(
- "main.email_branding_something_else",
- service_id=SERVICE_ONE_ID,
- )
- assert page.select_one(".usa-back-link")["href"] == url_for(
- "main.service_settings",
- service_id=SERVICE_ONE_ID,
- )
-
-
-@pytest.mark.parametrize(
- "endpoint",
- [
- ("main.email_branding_govuk"),
- ("main.email_branding_govuk_and_org"),
- ("main.email_branding_organization"),
- ],
-)
-def test_email_branding_pages_give_404_if_selected_branding_not_allowed(
- client_request,
- endpoint,
-):
- # The only email branding allowed is 'something_else', so trying to visit any of the other
- # endpoints gives a 404 status code.
- client_request.get(endpoint, service_id=SERVICE_ONE_ID, _expected_status=404)
-
-
-def test_email_branding_govuk_submit(
- mocker,
- client_request,
- service_one,
- organization_one,
- no_reply_to_email_addresses,
- mock_get_email_branding,
- single_sms_sender,
- mock_update_service,
-):
- mocker.patch(
- "app.organizations_client.get_organization",
- return_value=organization_one,
- )
- mocker.patch(
- "app.models.service.Service.organization_id",
- new_callable=PropertyMock,
- return_value=ORGANISATION_ID,
- )
- service_one["email_branding"] = sample_uuid()
-
- page = client_request.post(
- ".email_branding_govuk",
- service_id=SERVICE_ONE_ID,
- _follow_redirects=True,
- )
-
- mock_update_service.assert_called_once_with(
- SERVICE_ONE_ID,
- email_branding=None,
- )
- assert page.h1.text == "Settings"
- assert (
- normalize_spaces(page.select_one(".banner-default").text)
- == "You’ve updated your email branding"
- )
-
-
-@pytest.mark.skip(reason="Update for TTS")
-def test_email_branding_govuk_and_org_submit(
- mocker,
- client_request,
- service_one,
- organization_one,
- no_reply_to_email_addresses,
- mock_get_email_branding,
- single_sms_sender,
-):
- mocker.patch(
- "app.organizations_client.get_organization",
- return_value=organization_one,
- )
- mocker.patch(
- "app.models.service.Service.organization_id",
- new_callable=PropertyMock,
- return_value=ORGANISATION_ID,
- )
- service_one["email_branding"] = sample_uuid()
-
- mock_create_ticket = mocker.spy(NotifySupportTicket, "__init__")
- mock_send_ticket_to_zendesk = mocker.patch(
- "app.main.views.service_settings.zendesk_client.send_ticket_to_zendesk",
- autospec=True,
- )
-
- page = client_request.post(
- ".email_branding_govuk_and_org",
- service_id=SERVICE_ONE_ID,
- _follow_redirects=True,
- )
-
- mock_create_ticket.assert_called_once_with(
- ANY,
- message="\n".join(
- [
- "Organization: organization one",
- "Service: service one",
- "http://localhost/services/596364a0-858e-42c8-9062-a8fe822260eb",
- "",
- "---",
- "Current branding: Organization name",
- "Branding requested: GOV.UK and organization one\n",
- ]
- ),
- subject="Email branding request - service one",
- ticket_type="question",
- user_name="Test User",
- user_email="test@user.gsa.gov",
- org_id=ORGANISATION_ID,
- org_type="central",
- service_id=SERVICE_ONE_ID,
- )
- mock_send_ticket_to_zendesk.assert_called_once()
- assert normalize_spaces(page.select_one(".banner-default").text) == (
- "Thanks for your branding request. We’ll get back to you "
- "within one working day."
- )
-
-
-@pytest.mark.skip(reason="Update for TTS")
-def test_email_branding_organization_submit(
- mocker,
- client_request,
- service_one,
- organization_one,
- no_reply_to_email_addresses,
- mock_get_email_branding,
- single_sms_sender,
-):
- mocker.patch(
- "app.organizations_client.get_organization",
- return_value=organization_one,
- )
- mocker.patch(
- "app.models.service.Service.organization_id",
- new_callable=PropertyMock,
- return_value=ORGANISATION_ID,
- )
- service_one["email_branding"] = sample_uuid()
-
- mock_create_ticket = mocker.spy(NotifySupportTicket, "__init__")
- mock_send_ticket_to_zendesk = mocker.patch(
- "app.main.views.service_settings.zendesk_client.send_ticket_to_zendesk",
- autospec=True,
- )
-
- page = client_request.post(
- ".email_branding_organization",
- service_id=SERVICE_ONE_ID,
- _follow_redirects=True,
- )
-
- mock_create_ticket.assert_called_once_with(
- ANY,
- message="\n".join(
- [
- "Organization: organization one",
- "Service: service one",
- "http://localhost/services/596364a0-858e-42c8-9062-a8fe822260eb",
- "",
- "---",
- "Current branding: Organization name",
- "Branding requested: organization one\n",
- ]
- ),
- subject="Email branding request - service one",
- ticket_type="question",
- user_name="Test User",
- user_email="test@user.gsa.gov",
- org_id=ORGANISATION_ID,
- org_type="central",
- service_id=SERVICE_ONE_ID,
- )
- mock_send_ticket_to_zendesk.assert_called_once()
- assert normalize_spaces(page.select_one(".banner-default").text) == (
- "Thanks for your branding request. We’ll get back to you "
- "within one working day."
- )
-
-
-def test_email_branding_something_else_submit(
- client_request,
- mocker,
- service_one,
- no_reply_to_email_addresses,
- mock_get_email_branding,
- single_sms_sender,
-):
- service_one["email_branding"] = sample_uuid()
- service_one["organization_type"] = "nhs_local"
-
- mock_create_ticket = mocker.spy(NotifySupportTicket, "__init__")
- mock_send_ticket_to_zendesk = mocker.patch(
- "app.main.views.service_settings.zendesk_client.send_ticket_to_zendesk",
- autospec=True,
- )
-
- page = client_request.post(
- ".email_branding_something_else",
- service_id=SERVICE_ONE_ID,
- _data={"something_else": "Homer Simpson"},
- _follow_redirects=True,
- )
-
- mock_create_ticket.assert_called_once_with(
- ANY,
- message="\n".join(
- [
- "Organization: Can’t tell (domain is user.gsa.gov)",
- "Service: service one",
- "http://localhost/services/596364a0-858e-42c8-9062-a8fe822260eb",
- "",
- "---",
- "Current branding: Organization name",
- "Branding requested: Something else\n",
- "Homer Simpson\n",
- ]
- ),
- subject="Email branding request - service one",
- ticket_type="question",
- user_name="Test User",
- user_email="test@user.gsa.gov",
- org_id=None,
- org_type="nhs_local",
- service_id=SERVICE_ONE_ID,
- )
- mock_send_ticket_to_zendesk.assert_called_once()
- assert normalize_spaces(page.select_one(".banner-default").text) == (
- "Thanks for your branding request. We’ll get back to you "
- "within one working day."
- )
-
-
-def test_email_branding_something_else_submit_shows_error_if_textbox_is_empty(
- client_request,
-):
- page = client_request.post(
- ".email_branding_something_else",
- service_id=SERVICE_ONE_ID,
- _data={"something_else": ""},
- _follow_redirects=True,
- )
- assert normalize_spaces(page.h1.text) == "Describe the branding you want"
- assert (
- normalize_spaces(page.select_one(".usa-error-message").text)
- == "Error: Cannot be empty"
- )
diff --git a/tests/app/main/views/service_settings/test_service_settings.py b/tests/app/main/views/service_settings/test_service_settings.py
index ede9f1e92..906dcc883 100644
--- a/tests/app/main/views/service_settings/test_service_settings.py
+++ b/tests/app/main/views/service_settings/test_service_settings.py
@@ -1,7 +1,6 @@
from datetime import datetime
from functools import partial
from unittest.mock import ANY, Mock, PropertyMock, call
-from urllib.parse import parse_qs, urlparse
from uuid import uuid4
import pytest
@@ -83,7 +82,6 @@ def _mock_get_service_settings_page_common(
"Rate limit 3,000 per minute Change rate limit",
"Message batch limit 1,000 per send Change message batch limit",
"Free text message allowance 250,000 per year Change free text message allowance",
- "Email branding GOV.UK Change email branding (admin view)",
"Custom data retention Email – 7 days Change data retention",
"Receive inbound SMS Off Change your settings for Receive inbound SMS",
"Email authentication Off Change your settings for Email authentication",
@@ -256,13 +254,11 @@ def test_should_show_overview_for_service_with_more_things_set(
service_one,
single_reply_to_email_address,
single_sms_sender,
- mock_get_email_branding,
permissions,
expected_rows,
):
client_request.login(active_user_with_permissions)
service_one["permissions"] = permissions
- service_one["email_branding"] = uuid4()
page = client_request.get("main.service_settings", service_id=service_one["id"])
for index, row in enumerate(expected_rows):
assert row == " ".join(page.find_all("tr")[index + 1].text.split())
@@ -2823,247 +2819,6 @@ def test_does_not_show_research_mode_indicator(
assert not element
-@pytest.mark.parametrize(
- ("current_branding", "expected_values", "expected_labels"),
- [
- (
- None,
- [
- "__NONE__",
- "1",
- "2",
- "3",
- "4",
- "5",
- ],
- ["GOV.UK", "org 1", "org 2", "org 3", "org 4", "org 5"],
- ),
- (
- "5",
- [
- "5",
- "__NONE__",
- "1",
- "2",
- "3",
- "4",
- ],
- [
- "org 5",
- "GOV.UK",
- "org 1",
- "org 2",
- "org 3",
- "org 4",
- ],
- ),
- ],
-)
-@pytest.mark.parametrize(
- ("endpoint", "extra_args"),
- [
- (
- "main.service_set_email_branding",
- {"service_id": SERVICE_ONE_ID},
- ),
- (
- "main.edit_organization_email_branding",
- {"org_id": ORGANISATION_ID},
- ),
- ],
-)
-def test_should_show_branding_styles(
- mocker,
- client_request,
- platform_admin_user,
- service_one,
- mock_get_all_email_branding,
- current_branding,
- expected_values,
- expected_labels,
- endpoint,
- extra_args,
-):
- service_one["email_branding"] = current_branding
- mocker.patch(
- "app.organizations_client.get_organization",
- side_effect=lambda org_id: organization_json(
- org_id,
- "Org 1",
- email_branding_id=current_branding,
- ),
- )
-
- client_request.login(platform_admin_user)
- page = client_request.get(endpoint, **extra_args)
-
- branding_style_choices = page.find_all("input", attrs={"name": "branding_style"})
-
- radio_labels = [
- page.find("label", attrs={"for": branding_style_choices[idx]["id"]})
- .get_text()
- .strip()
- for idx, element in enumerate(branding_style_choices)
- ]
-
- assert len(branding_style_choices) == 6
-
- for index, expected_value in enumerate(expected_values):
- assert branding_style_choices[index]["value"] == expected_value
-
- # radios should be in alphabetical order, based on their labels
- assert radio_labels == expected_labels
-
- assert "checked" in branding_style_choices[0].attrs
- assert "checked" not in branding_style_choices[1].attrs
- assert "checked" not in branding_style_choices[2].attrs
- assert "checked" not in branding_style_choices[3].attrs
- assert "checked" not in branding_style_choices[4].attrs
- assert "checked" not in branding_style_choices[5].attrs
-
- app.email_branding_client.get_all_email_branding.assert_called_once_with()
- app.service_api_client.get_service.assert_called_once_with(service_one["id"])
-
-
-@pytest.mark.parametrize(
- ("endpoint", "extra_args", "expected_redirect"),
- [
- (
- "main.service_set_email_branding",
- {"service_id": SERVICE_ONE_ID},
- "main.service_preview_email_branding",
- ),
- (
- "main.edit_organization_email_branding",
- {"org_id": ORGANISATION_ID},
- "main.organization_preview_email_branding",
- ),
- ],
-)
-def test_should_send_branding_and_organizations_to_preview(
- client_request,
- platform_admin_user,
- service_one,
- mock_get_organization,
- mock_get_all_email_branding,
- mock_update_service,
- endpoint,
- extra_args,
- expected_redirect,
-):
- client_request.login(platform_admin_user)
- client_request.post(
- endpoint,
- _data={"branding_type": "org", "branding_style": "1"},
- _expected_status=302,
- _expected_location=url_for(expected_redirect, branding_style="1", **extra_args),
- **extra_args,
- )
-
- mock_get_all_email_branding.assert_called_once_with()
-
-
-@pytest.mark.parametrize(
- ("endpoint", "extra_args"),
- [
- (
- "main.service_preview_email_branding",
- {"service_id": SERVICE_ONE_ID},
- ),
- (
- "main.organization_preview_email_branding",
- {"org_id": ORGANISATION_ID},
- ),
- ],
-)
-def test_should_preview_email_branding(
- client_request,
- platform_admin_user,
- mock_get_organization,
- endpoint,
- extra_args,
-):
- client_request.login(platform_admin_user)
- page = client_request.get(
- endpoint, branding_type="org", branding_style="1", **extra_args
- )
-
- iframe = page.find("iframe", attrs={"class": "branding-preview"})
- iframeURLComponents = urlparse(iframe["src"])
- iframeQString = parse_qs(iframeURLComponents.query)
-
- assert page.find("input", attrs={"id": "branding_style"})["value"] == "1"
- assert iframeURLComponents.path == "/_email"
- assert iframeQString["branding_style"] == ["1"]
-
-
-@pytest.mark.parametrize(
- ("posted_value", "submitted_value"),
- [
- ("1", "1"),
- ("__NONE__", None),
- pytest.param("None", None, marks=pytest.mark.xfail(raises=AssertionError)),
- ],
-)
-@pytest.mark.parametrize(
- ("endpoint", "extra_args", "expected_redirect"),
- [
- (
- "main.service_preview_email_branding",
- {"service_id": SERVICE_ONE_ID},
- "main.service_settings",
- ),
- (
- "main.organization_preview_email_branding",
- {"org_id": ORGANISATION_ID},
- "main.organization_settings",
- ),
- ],
-)
-def test_should_set_branding_and_organizations(
- client_request,
- platform_admin_user,
- service_one,
- mock_get_organization,
- mock_get_organization_services,
- mock_update_service,
- mock_update_organization,
- posted_value,
- submitted_value,
- endpoint,
- extra_args,
- expected_redirect,
-):
- client_request.login(platform_admin_user)
- client_request.post(
- endpoint,
- _data={"branding_style": posted_value},
- _expected_status=302,
- _expected_redirect=url_for(expected_redirect, **extra_args),
- **extra_args,
- )
-
- if endpoint == "main.service_preview_email_branding":
- mock_update_service.assert_called_once_with(
- SERVICE_ONE_ID,
- email_branding=submitted_value,
- )
- assert mock_update_organization.called is False
- elif endpoint == "main.organization_preview_email_branding":
- mock_update_organization.assert_called_once_with(
- ORGANISATION_ID,
- email_branding_id=submitted_value,
- cached_service_ids=[
- "12345",
- "67890",
- "596364a0-858e-42c8-9062-a8fe822260eb",
- ],
- )
- assert mock_update_service.called is False
- else:
- raise Exception
-
-
@pytest.mark.parametrize("method", ["get", "post"])
@pytest.mark.parametrize(
"endpoint",
@@ -4170,33 +3925,6 @@ def test_update_service_organization_does_not_update_if_same_value(
assert mock_update_service_organization.called is False
-@pytest.mark.skip(reason="Email currently deactivated")
-@pytest.mark.parametrize(
- ("single_branding_option", "expected_href"),
- [
- (
- True,
- f"/services/{SERVICE_ONE_ID}/service-settings/email-branding/something-else",
- ),
- ],
-)
-def test_service_settings_links_to_branding_request_page_for_emails(
- service_one,
- client_request,
- no_reply_to_email_addresses,
- single_sms_sender,
- single_branding_option,
- expected_href,
-):
- if single_branding_option:
- # should only have a "something else" option
- # so we go straight to that form
- service_one["organization_type"] = "other"
-
- page = client_request.get(".service_settings", service_id=SERVICE_ONE_ID)
- assert len(page.find_all("a", attrs={"href": expected_href})) == 1
-
-
def test_show_service_data_retention(
client_request,
platform_admin_user,
diff --git a/tests/app/main/views/test_add_service.py b/tests/app/main/views/test_add_service.py
index 0d04715ac..4f2ab9964 100644
--- a/tests/app/main/views/test_add_service.py
+++ b/tests/app/main/views/test_add_service.py
@@ -97,7 +97,6 @@ def test_should_add_service_and_redirect_to_tour_when_no_services(
mock_create_service_template,
mock_get_services_with_no_services,
api_user_active,
- mock_get_all_email_branding,
inherited,
email_address,
posted,
@@ -153,7 +152,6 @@ def test_add_service_has_to_choose_org_type(
mock_create_service_template,
mock_get_services_with_no_services,
api_user_active,
- mock_get_all_email_branding,
platform_admin_user,
):
client_request.login(platform_admin_user)
@@ -227,7 +225,6 @@ def test_should_add_service_and_redirect_to_dashboard_when_existing_service(
api_user_active,
organization_type,
free_allowance,
- mock_get_all_email_branding,
platform_admin_user,
):
client_request.login(platform_admin_user)
diff --git a/tests/app/main/views/test_email_branding.py b/tests/app/main/views/test_email_branding.py
deleted file mode 100644
index fe86c108c..000000000
--- a/tests/app/main/views/test_email_branding.py
+++ /dev/null
@@ -1,451 +0,0 @@
-from io import BytesIO
-from unittest.mock import call
-
-import pytest
-from flask import url_for
-from notifications_python_client.errors import HTTPError
-
-from app.s3_client.s3_logo_client import EMAIL_LOGO_LOCATION_STRUCTURE, TEMP_TAG
-from tests.conftest import create_email_branding, normalize_spaces
-
-
-def test_email_branding_page_shows_full_branding_list(
- client_request, platform_admin_user, mock_get_all_email_branding
-):
- client_request.login(platform_admin_user)
- page = client_request.get(".email_branding")
-
- links = page.select(".message-name a")
- brand_names = [normalize_spaces(link.text) for link in links]
- hrefs = [link["href"] for link in links]
-
- assert normalize_spaces(page.select_one("h1").text) == "Email branding"
-
- assert page.select(".grid-col-9 a")[-1]["href"] == url_for(
- "main.create_email_branding"
- )
-
- assert brand_names == [
- "org 1",
- "org 2",
- "org 3",
- "org 4",
- "org 5",
- ]
- assert hrefs == [
- url_for(".update_email_branding", branding_id=1),
- url_for(".update_email_branding", branding_id=2),
- url_for(".update_email_branding", branding_id=3),
- url_for(".update_email_branding", branding_id=4),
- url_for(".update_email_branding", branding_id=5),
- ]
-
-
-def test_edit_email_branding_shows_the_correct_branding_info(
- client_request, platform_admin_user, mock_get_email_branding, fake_uuid
-):
- client_request.login(platform_admin_user)
- page = client_request.get(
- ".update_email_branding",
- branding_id=fake_uuid,
- _test_page_title=False, # TODO: Fix page titles
- )
-
- assert page.select_one("#logo-img > img")["src"].endswith("/example.png")
- assert page.select_one("#name").attrs.get("value") == "Organization name"
- assert page.select_one("#file").attrs.get("accept") == ".png"
- assert page.select_one("#text").attrs.get("value") == "Organization text"
- assert page.select_one("#colour").attrs.get("value") == "#f00"
-
-
-def test_create_email_branding_does_not_show_any_branding_info(
- client_request, platform_admin_user, mock_no_email_branding
-):
- client_request.login(platform_admin_user)
- page = client_request.get(
- ".create_email_branding",
- _test_page_title=False, # TODO: Fix page titles
- )
-
- assert page.select_one("#logo-img > img") is None
- assert page.select_one("#name").attrs.get("value") is None
- assert page.select_one("#file").attrs.get("accept") == ".png"
- assert page.select_one("#text").attrs.get("value") is None
- assert page.select_one("#colour").attrs.get("value") is None
-
-
-def test_create_new_email_branding_without_logo(
- client_request,
- platform_admin_user,
- mocker,
- fake_uuid,
- mock_create_email_branding,
-):
- data = {
- "logo": None,
- "colour": "#ff0000",
- "text": "new text",
- "name": "new name",
- "brand_type": "org",
- }
-
- mock_persist = mocker.patch("app.main.views.email_branding.persist_logo")
- mocker.patch("app.main.views.email_branding.delete_email_temp_files_created_by")
-
- client_request.login(platform_admin_user)
- client_request.post(
- ".create_email_branding",
- _content_type="multipart/form-data",
- _data=data,
- )
-
- assert mock_create_email_branding.called
- assert mock_create_email_branding.call_args == call(
- logo=data["logo"],
- name=data["name"],
- text=data["text"],
- colour=data["colour"],
- brand_type=data["brand_type"],
- )
- assert mock_persist.call_args_list == []
-
-
-def test_create_email_branding_requires_a_name_when_submitting_logo_details(
- client_request,
- mocker,
- mock_create_email_branding,
- platform_admin_user,
-):
- mocker.patch("app.main.views.email_branding.persist_logo")
- mocker.patch("app.main.views.email_branding.delete_email_temp_files_created_by")
- data = {
- "operation": "email-branding-details",
- "logo": "",
- "colour": "#ff0000",
- "text": "new text",
- "name": "",
- "brand_type": "org",
- }
- client_request.login(platform_admin_user)
- page = client_request.post(
- ".create_email_branding",
- _content_type="multipart/form-data",
- _data=data,
- _expected_status=200,
- )
-
- assert (
- page.select_one(".usa-error-message").text.strip()
- == "Error: This field is required"
- )
- assert mock_create_email_branding.called is False
-
-
-def test_create_email_branding_does_not_require_a_name_when_uploading_a_file(
- client_request,
- mocker,
- platform_admin_user,
-):
- mocker.patch(
- "app.main.views.email_branding.upload_email_logo", return_value="temp_filename"
- )
- data = {
- "file": (BytesIO("".encode("utf-8")), "test.png"),
- "colour": "",
- "text": "",
- "name": "",
- "brand_type": "org",
- }
- client_request.login(platform_admin_user)
- page = client_request.post(
- ".create_email_branding",
- _content_type="multipart/form-data",
- _data=data,
- _follow_redirects=True,
- )
-
- assert not page.find(".error-message")
-
-
-def test_create_new_email_branding_when_branding_saved(
- client_request, platform_admin_user, mocker, mock_create_email_branding, fake_uuid
-):
- with client_request.session_transaction() as session:
- user_id = session["user_id"]
-
- data = {
- "logo": "test.png",
- "colour": "#ff0000",
- "text": "new text",
- "name": "new name",
- "brand_type": "org_banner",
- }
-
- temp_filename = EMAIL_LOGO_LOCATION_STRUCTURE.format(
- temp=TEMP_TAG.format(user_id=user_id),
- unique_id=fake_uuid,
- filename=data["logo"],
- )
-
- mocker.patch("app.main.views.email_branding.persist_logo")
- mocker.patch("app.main.views.email_branding.delete_email_temp_files_created_by")
-
- client_request.login(platform_admin_user)
- client_request.post(
- ".create_email_branding",
- logo=temp_filename,
- _content_type="multipart/form-data",
- _data={
- "colour": data["colour"],
- "name": data["name"],
- "text": data["text"],
- "cdn_url": "https://static-logos.cdn.com",
- "brand_type": data["brand_type"],
- },
- )
-
- updated_logo_name = "{}-{}".format(fake_uuid, data["logo"])
-
- assert mock_create_email_branding.called
- assert mock_create_email_branding.call_args == call(
- logo=updated_logo_name,
- name=data["name"],
- text=data["text"],
- colour=data["colour"],
- brand_type=data["brand_type"],
- )
-
-
-@pytest.mark.parametrize(
- ("endpoint", "has_data"),
- [
- ("main.create_email_branding", False),
- ("main.update_email_branding", True),
- ],
-)
-def test_deletes_previous_temp_logo_after_uploading_logo(
- client_request, platform_admin_user, mocker, endpoint, has_data, fake_uuid
-):
- if has_data:
- mocker.patch(
- "app.email_branding_client.get_email_branding",
- return_value=create_email_branding(fake_uuid),
- )
-
- with client_request.session_transaction() as session:
- user_id = session["user_id"]
-
- temp_old_filename = EMAIL_LOGO_LOCATION_STRUCTURE.format(
- temp=TEMP_TAG.format(user_id=user_id),
- unique_id=fake_uuid,
- filename="old_test.png",
- )
-
- temp_filename = EMAIL_LOGO_LOCATION_STRUCTURE.format(
- temp=TEMP_TAG.format(user_id=user_id), unique_id=fake_uuid, filename="test.png"
- )
-
- mocked_upload_email_logo = mocker.patch(
- "app.main.views.email_branding.upload_email_logo", return_value=temp_filename
- )
-
- mocked_delete_email_temp_file = mocker.patch(
- "app.main.views.email_branding.delete_email_temp_file"
- )
-
- client_request.login(platform_admin_user)
- client_request.post(
- "main.create_email_branding",
- logo=temp_old_filename,
- branding_id=fake_uuid,
- _data={"file": (BytesIO("".encode("utf-8")), "test.png")},
- _content_type="multipart/form-data",
- )
-
- assert mocked_upload_email_logo.called
- assert mocked_delete_email_temp_file.called
- assert mocked_delete_email_temp_file.call_args == call(temp_old_filename)
-
-
-def test_update_existing_branding(
- client_request,
- platform_admin_user,
- mocker,
- fake_uuid,
- mock_get_email_branding,
- mock_update_email_branding,
-):
- with client_request.session_transaction() as session:
- user_id = session["user_id"]
-
- data = {
- "logo": "test.png",
- "colour": "#0000ff",
- "text": "new text",
- "name": "new name",
- "brand_type": "both",
- }
-
- temp_filename = EMAIL_LOGO_LOCATION_STRUCTURE.format(
- temp=TEMP_TAG.format(user_id=user_id),
- unique_id=fake_uuid,
- filename=data["logo"],
- )
-
- mocker.patch("app.main.views.email_branding.persist_logo")
- mocker.patch("app.main.views.email_branding.delete_email_temp_files_created_by")
-
- client_request.login(platform_admin_user)
- client_request.post(
- ".update_email_branding",
- logo=temp_filename,
- branding_id=fake_uuid,
- _content_type="multipart/form-data",
- _data={
- "colour": data["colour"],
- "name": data["name"],
- "text": data["text"],
- "cdn_url": "https://static-logos.cdn.com",
- "brand_type": data["brand_type"],
- },
- )
-
- updated_logo_name = "{}-{}".format(fake_uuid, data["logo"])
-
- assert mock_update_email_branding.called
- assert mock_update_email_branding.call_args == call(
- branding_id=fake_uuid,
- logo=updated_logo_name,
- name=data["name"],
- text=data["text"],
- colour=data["colour"],
- brand_type=data["brand_type"],
- )
-
-
-def test_temp_logo_is_shown_after_uploading_logo(
- client_request,
- platform_admin_user,
- mocker,
- fake_uuid,
-):
- with client_request.session_transaction() as session:
- user_id = session["user_id"]
-
- temp_filename = EMAIL_LOGO_LOCATION_STRUCTURE.format(
- temp=TEMP_TAG.format(user_id=user_id), unique_id=fake_uuid, filename="test.png"
- )
-
- mocker.patch(
- "app.main.views.email_branding.upload_email_logo", return_value=temp_filename
- )
- mocker.patch("app.main.views.email_branding.delete_email_temp_file")
-
- client_request.login(platform_admin_user)
- page = client_request.post(
- "main.create_email_branding",
- _data={"file": (BytesIO("".encode("utf-8")), "test.png")},
- _content_type="multipart/form-data",
- _follow_redirects=True,
- )
-
- assert page.select_one("#logo-img > img").attrs["src"].endswith(temp_filename)
-
-
-def test_logo_persisted_when_organization_saved(
- client_request, platform_admin_user, mock_create_email_branding, mocker, fake_uuid
-):
- with client_request.session_transaction() as session:
- user_id = session["user_id"]
-
- temp_filename = EMAIL_LOGO_LOCATION_STRUCTURE.format(
- temp=TEMP_TAG.format(user_id=user_id), unique_id=fake_uuid, filename="test.png"
- )
-
- mocked_upload_email_logo = mocker.patch(
- "app.main.views.email_branding.upload_email_logo"
- )
- mocked_persist_logo = mocker.patch("app.main.views.email_branding.persist_logo")
- mocked_delete_email_temp_files_by = mocker.patch(
- "app.main.views.email_branding.delete_email_temp_files_created_by"
- )
-
- client_request.login(platform_admin_user)
- client_request.post(
- ".create_email_branding",
- logo=temp_filename,
- _content_type="multipart/form-data",
- )
-
- assert not mocked_upload_email_logo.called
- assert mocked_persist_logo.called
- assert mocked_delete_email_temp_files_by.called
- assert mocked_delete_email_temp_files_by.call_args == call(user_id)
- assert mock_create_email_branding.called
-
-
-def test_logo_does_not_get_persisted_if_updating_email_branding_client_throws_an_error(
- client_request, platform_admin_user, mock_create_email_branding, mocker, fake_uuid
-):
- with client_request.session_transaction() as session:
- user_id = session["user_id"]
-
- temp_filename = EMAIL_LOGO_LOCATION_STRUCTURE.format(
- temp=TEMP_TAG.format(user_id=user_id), unique_id=fake_uuid, filename="test.png"
- )
-
- mocked_persist_logo = mocker.patch("app.main.views.email_branding.persist_logo")
- mocked_delete_email_temp_files_by = mocker.patch(
- "app.main.views.email_branding.delete_email_temp_files_created_by"
- )
- mocker.patch(
- "app.main.views.email_branding.email_branding_client.create_email_branding",
- side_effect=HTTPError(),
- )
-
- client_request.login(platform_admin_user)
- client_request.post(
- ".create_email_branding",
- logo=temp_filename,
- _content_type="multipart/form-data",
- _expected_status=500,
- )
-
- assert not mocked_persist_logo.called
- assert not mocked_delete_email_temp_files_by.called
-
-
-@pytest.mark.parametrize(
- ("colour_hex", "expected_status_code"),
- [
- ("#FF00FF", 302),
- ("hello", 200),
- ("", 302),
- ],
-)
-def test_colour_regex_validation(
- client_request,
- platform_admin_user,
- mocker,
- fake_uuid,
- colour_hex,
- expected_status_code,
- mock_create_email_branding,
-):
- data = {
- "logo": None,
- "colour": colour_hex,
- "text": "new text",
- "name": "new name",
- "brand_type": "org",
- }
-
- mocker.patch("app.main.views.email_branding.delete_email_temp_files_created_by")
-
- client_request.login(platform_admin_user)
- client_request.post(
- ".create_email_branding",
- _content_type="multipart/form-data",
- _data=data,
- _expected_status=expected_status_code,
- )
diff --git a/tests/app/main/views/test_email_preview.py b/tests/app/main/views/test_email_preview.py
deleted file mode 100644
index 60604a9f3..000000000
--- a/tests/app/main/views/test_email_preview.py
+++ /dev/null
@@ -1,95 +0,0 @@
-import re
-
-import pytest
-
-
-@pytest.mark.parametrize(
- ("query_args", "result"), [({}, True), ({"govuk_banner": "false"}, "false")]
-)
-def test_renders(client_request, mocker, query_args, result):
- mocker.patch(
- "app.main.views.index.HTMLEmailTemplate.__str__", return_value="rendered"
- )
-
- response = client_request.get_response("main.email_template", **query_args)
-
- assert response.get_data(as_text=True) == "rendered"
-
-
-def test_displays_both_branding(
- client_request, mock_get_email_branding_with_both_brand_type
-):
- page = client_request.get(
- "main.email_template", branding_style="1", _test_page_title=False
- )
-
- mock_get_email_branding_with_both_brand_type.assert_called_once_with("1")
-
- assert page.find("img", attrs={"src": re.compile("example.png$")})
- assert (
- page.select(
- "body > table:nth-of-type(3) table > tr:nth-of-type(1) > td:nth-of-type(2)"
- )[0]
- .get_text()
- .strip()
- == "Organization text"
- ) # brand text is set
-
-
-def test_displays_org_branding(client_request, mock_get_email_branding):
- # mock_get_email_branding has 'brand_type' of 'org'
- page = client_request.get(
- "main.email_template", branding_style="1", _test_page_title=False
- )
-
- mock_get_email_branding.assert_called_once_with("1")
-
- assert not page.find("a", attrs={"href": "https://www.gsa.gov"})
- assert page.find("img", attrs={"src": re.compile("example.png")})
- assert not page.select(
- "body > table > tr > td[bgcolor='#f00']"
- ) # banner colour is not set
- assert (
- page.select(
- "body > table:nth-of-type(1) > tr:nth-of-type(1) > td:nth-of-type(2)"
- )[0]
- .get_text()
- .strip()
- == "Organization text"
- ) # brand text is set
-
-
-def test_displays_org_branding_with_banner(
- client_request, mock_get_email_branding_with_org_banner_brand_type
-):
- page = client_request.get(
- "main.email_template", branding_style="1", _test_page_title=False
- )
-
- mock_get_email_branding_with_org_banner_brand_type.assert_called_once_with("1")
-
- assert not page.find("a", attrs={"href": "https://www.gsa.gov"})
- assert page.find("img", attrs={"src": re.compile("example.png")})
- assert page.select("body > table > tr > td[bgcolor='#f00']") # banner colour is set
- assert (
- page.select("body > table table > tr > td > span")[0].get_text().strip()
- == "Organization text"
- ) # brand text is set
-
-
-def test_displays_org_branding_with_banner_without_brand_text(
- client_request, mock_get_email_branding_without_brand_text
-):
- # mock_get_email_branding_without_brand_text has 'brand_type' of 'org_banner'
- page = client_request.get(
- "main.email_template", branding_style="1", _test_page_title=False
- )
-
- mock_get_email_branding_without_brand_text.assert_called_once_with("1")
-
- assert not page.find("a", attrs={"href": "https://www.gsa.gov"})
- assert page.find("img", attrs={"src": re.compile("example.png")})
- assert page.select("body > table > tr > td[bgcolor='#f00']") # banner colour is set
- assert (
- not page.select("body > table table > tr > td > span") == 0
- ) # brand text is not set
diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py
index 7311dbaaa..ac55aed4f 100644
--- a/tests/app/main/views/test_index.py
+++ b/tests/app/main/views/test_index.py
@@ -5,7 +5,7 @@ from bs4 import BeautifulSoup
from flask import url_for
from freezegun import freeze_time
-from tests.conftest import SERVICE_ONE_ID, normalize_spaces, sample_uuid
+from tests.conftest import SERVICE_ONE_ID, normalize_spaces
def test_non_logged_in_user_can_see_homepage(
@@ -104,12 +104,10 @@ def test_hiding_pages_from_search_engines(
"documentation",
"security",
"message_status",
- "features_email",
"features_sms",
"how_to_pay",
"get_started",
"guidance_index",
- "branding_and_customisation",
"create_and_send_messages",
"edit_and_format_messages",
"send_files_by_email",
@@ -265,36 +263,6 @@ def test_css_is_served_from_correct_path(client_request):
# assert logo_svg_fallback['src'].startswith('https://static.example.com/images/us-notify-color.png')
-@pytest.mark.parametrize(
- ("extra_args", "email_branding_retrieved"),
- [
- (
- {},
- False,
- ),
- (
- {"branding_style": "__NONE__"},
- False,
- ),
- (
- {"branding_style": sample_uuid()},
- True,
- ),
- ],
-)
-def test_email_branding_preview(
- client_request,
- mock_get_email_branding,
- extra_args,
- email_branding_retrieved,
-):
- page = client_request.get(
- "main.email_template", _test_page_title=False, **extra_args
- )
- assert page.title.text == "Email branding preview"
- assert mock_get_email_branding.called is email_branding_retrieved
-
-
@pytest.mark.parametrize(
("current_date", "expected_rate"),
[
diff --git a/tests/app/main/views/test_platform_admin.py b/tests/app/main/views/test_platform_admin.py
index 49206d873..f5e7862a7 100644
--- a/tests/app/main/views/test_platform_admin.py
+++ b/tests/app/main/views/test_platform_admin.py
@@ -757,7 +757,6 @@ def test_clear_cache_shows_form(
"user",
"service",
"template",
- "email_branding",
"organization",
}
diff --git a/tests/app/models/test_event.py b/tests/app/models/test_event.py
index 4f64f7a32..bbff4fe91 100644
--- a/tests/app/models/test_event.py
+++ b/tests/app/models/test_event.py
@@ -12,7 +12,6 @@ from tests.conftest import sample_uuid
("active", False, True, ("Unsuspended this service")),
("active", True, False, ("Deleted this service")),
("contact_link", "x", "y", ("Set the contact details for this service to ‘y’")),
- ("email_branding", "foo", "bar", ("Updated this service’s email branding")),
(
"inbound_api",
"foo",
diff --git a/tests/app/notify_client/test_email_branding_client.py b/tests/app/notify_client/test_email_branding_client.py
deleted file mode 100644
index 85b2c12c9..000000000
--- a/tests/app/notify_client/test_email_branding_client.py
+++ /dev/null
@@ -1,104 +0,0 @@
-from unittest.mock import call
-
-from app.notify_client.email_branding_client import EmailBrandingClient
-
-
-def test_get_email_branding(mocker, fake_uuid):
- mock_get = mocker.patch(
- "app.notify_client.email_branding_client.EmailBrandingClient.get",
- return_value={"foo": "bar"},
- )
- mock_redis_get = mocker.patch(
- "app.extensions.RedisClient.get",
- return_value=None,
- )
- mock_redis_set = mocker.patch(
- "app.extensions.RedisClient.set",
- )
- EmailBrandingClient().get_email_branding(fake_uuid)
- mock_get.assert_called_once_with(url="/email-branding/{}".format(fake_uuid))
- mock_redis_get.assert_called_once_with("email_branding-{}".format(fake_uuid))
- mock_redis_set.assert_called_once_with(
- "email_branding-{}".format(fake_uuid),
- '{"foo": "bar"}',
- ex=604800,
- )
-
-
-def test_get_all_email_branding(mocker):
- mock_get = mocker.patch(
- "app.notify_client.email_branding_client.EmailBrandingClient.get",
- return_value={"email_branding": [1, 2, 3]},
- )
- mock_redis_get = mocker.patch(
- "app.extensions.RedisClient.get",
- return_value=None,
- )
- mock_redis_set = mocker.patch(
- "app.extensions.RedisClient.set",
- )
- EmailBrandingClient().get_all_email_branding()
- mock_get.assert_called_once_with(url="/email-branding")
- mock_redis_get.assert_called_once_with("email_branding")
- mock_redis_set.assert_called_once_with(
- "email_branding",
- "[1, 2, 3]",
- ex=604800,
- )
-
-
-def test_create_email_branding(mocker):
- org_data = {
- "logo": "test.png",
- "name": "test name",
- "text": "test name",
- "colour": "red",
- "brand_type": "org",
- }
-
- mock_post = mocker.patch(
- "app.notify_client.email_branding_client.EmailBrandingClient.post"
- )
- mock_redis_delete = mocker.patch("app.extensions.RedisClient.delete")
- EmailBrandingClient().create_email_branding(
- logo=org_data["logo"],
- name=org_data["name"],
- text=org_data["text"],
- colour=org_data["colour"],
- brand_type="org",
- )
-
- mock_post.assert_called_once_with(url="/email-branding", data=org_data)
-
- mock_redis_delete.assert_called_once_with("email_branding")
-
-
-def test_update_email_branding(mocker, fake_uuid):
- org_data = {
- "logo": "test.png",
- "name": "test name",
- "text": "test name",
- "colour": "red",
- "brand_type": "org",
- }
-
- mock_post = mocker.patch(
- "app.notify_client.email_branding_client.EmailBrandingClient.post"
- )
- mock_redis_delete = mocker.patch("app.extensions.RedisClient.delete")
- EmailBrandingClient().update_email_branding(
- branding_id=fake_uuid,
- logo=org_data["logo"],
- name=org_data["name"],
- text=org_data["text"],
- colour=org_data["colour"],
- brand_type="org",
- )
-
- mock_post.assert_called_once_with(
- url="/email-branding/{}".format(fake_uuid), data=org_data
- )
- assert mock_redis_delete.call_args_list == [
- call("email_branding-{}".format(fake_uuid)),
- call("email_branding"),
- ]
diff --git a/tests/app/notify_client/test_service_api_client.py b/tests/app/notify_client/test_service_api_client.py
index acffa3f8a..815f3e5e2 100644
--- a/tests/app/notify_client/test_service_api_client.py
+++ b/tests/app/notify_client/test_service_api_client.py
@@ -632,7 +632,6 @@ def test_client_updates_service_with_allowed_attributes(
"consent_to_research",
"contact_link",
"count_as_live",
- "email_branding",
"email_from",
"free_sms_fragment_limit",
"go_live_at",
diff --git a/tests/app/test_navigation.py b/tests/app/test_navigation.py
index 9873d6422..2f890d7b3 100644
--- a/tests/app/test_navigation.py
+++ b/tests/app/test_navigation.py
@@ -34,7 +34,6 @@ EXCLUDED_ENDPOINTS = tuple(
"bat_phone",
"begin_tour",
"billing_details",
- "branding_and_customisation",
"callbacks",
"cancel_invited_org_user",
"cancel_invited_user",
@@ -61,7 +60,6 @@ EXCLUDED_ENDPOINTS = tuple(
"count_content_length",
"create_and_send_messages",
"create_api_key",
- "create_email_branding",
"data_retention",
"delete_service_template",
"delete_template_folder",
@@ -75,7 +73,6 @@ EXCLUDED_ENDPOINTS = tuple(
"edit_data_retention",
"edit_organization_billing_details",
"edit_organization_domains",
- "edit_organization_email_branding",
"edit_organization_go_live_notes",
"edit_organization_name",
"edit_organization_notes",
@@ -87,18 +84,10 @@ EXCLUDED_ENDPOINTS = tuple(
"edit_user_email",
"edit_user_mobile_number",
"edit_user_permissions",
- "email_branding",
- "email_branding_govuk",
- "email_branding_govuk_and_org",
- "email_branding_organization",
- "email_branding_request",
- "email_branding_something_else",
"email_not_received",
- "email_template",
"error",
"estimate_usage",
"features",
- "features_email",
"features_sms",
"feedback",
"find_services_by_name",
@@ -146,7 +135,6 @@ EXCLUDED_ENDPOINTS = tuple(
"old_using_notify",
"organization_billing",
"organization_dashboard",
- "organization_preview_email_branding",
"organization_settings",
"organization_trial_mode_services",
"organizations",
@@ -193,10 +181,8 @@ EXCLUDED_ENDPOINTS = tuple(
"service_edit_sms_sender",
"service_email_reply_to",
"service_name_change",
- "service_preview_email_branding",
"service_set_auth_type",
"service_set_channel",
- "service_set_email_branding",
"service_set_inbound_number",
"service_set_inbound_sms",
"service_set_international_sms",
@@ -236,7 +222,6 @@ EXCLUDED_ENDPOINTS = tuple(
"two_factor_email",
"two_factor_email_interstitial",
"two_factor_email_sent",
- "update_email_branding",
"uploads",
"usage",
"user_information",
diff --git a/tests/app/utils/test_branding.py b/tests/app/utils/test_branding.py
deleted file mode 100644
index 8c1aae4bd..000000000
--- a/tests/app/utils/test_branding.py
+++ /dev/null
@@ -1,189 +0,0 @@
-from unittest.mock import PropertyMock
-
-import pytest
-
-from app.models.service import Service
-from app.utils.branding import get_email_choices
-from tests import organization_json
-from tests.conftest import create_email_branding
-
-
-@pytest.mark.parametrize("function", [get_email_choices])
-@pytest.mark.parametrize(
- ("org_type", "expected_options"),
- [
- ("federal", []),
- ("state", []),
- ],
-)
-def test_get_choices_service_not_assigned_to_org(
- service_one,
- function,
- org_type,
- expected_options,
-):
- service_one["organization_type"] = org_type
- service = Service(service_one)
-
- options = function(service)
- assert list(options) == expected_options
-
-
-@pytest.mark.parametrize(
- ("org_type", "branding_id", "expected_options"),
- [
- (
- "federal",
- None,
- [
- ("govuk_and_org", "GOV.UK and Test Organization"),
- ("organization", "Test Organization"),
- ],
- ),
- (
- "federal",
- "some-branding-id",
- [
- ("govuk", "GOV.UK"), # central orgs can switch back to gsa.gov
- ("govuk_and_org", "GOV.UK and Test Organization"),
- ("organization", "Test Organization"),
- ],
- ),
- ("state", None, [("organization", "Test Organization")]),
- ("state", "some-branding-id", [("organization", "Test Organization")]),
- # ('nhs_central', None, [
- # ('nhs', 'NHS')
- # ]),
- # ('nhs_central', NHS_EMAIL_BRANDING_ID, [
- # # don't show NHS if it's the current branding
- # ]),
- ],
-)
-@pytest.mark.skip(reason="Update for TTS")
-def test_get_email_choices_service_assigned_to_org(
- mocker,
- service_one,
- org_type,
- branding_id,
- expected_options,
- mock_get_service_organization,
- mock_get_email_branding,
-):
- service = Service(service_one)
-
- mocker.patch(
- "app.organizations_client.get_organization",
- return_value=organization_json(organization_type=org_type),
- )
- mocker.patch(
- "app.models.service.Service.email_branding_id",
- new_callable=PropertyMock,
- return_value=branding_id,
- )
-
- options = get_email_choices(service)
- assert list(options) == expected_options
-
-
-@pytest.mark.parametrize(
- ("org_type", "branding_id", "expected_options"),
- [
- (
- "federal",
- "some-branding-id",
- [
- # don't show gsa.gov options as org default supersedes it
- ("organization", "Test Organization"),
- ],
- ),
- (
- "federal",
- "org-branding-id",
- [
- # also don't show org option if it's the current branding
- ],
- ),
- (
- "state",
- "org-branding-id",
- [
- # don't show org option if it's the current branding
- ],
- ),
- ],
-)
-@pytest.mark.skip(reason="Update for TTS")
-def test_get_email_choices_org_has_default_branding(
- mocker,
- service_one,
- org_type,
- branding_id,
- expected_options,
- mock_get_service_organization,
- mock_get_email_branding,
-):
- service = Service(service_one)
-
- mocker.patch(
- "app.organizations_client.get_organization",
- return_value=organization_json(
- organization_type=org_type, email_branding_id="org-branding-id"
- ),
- )
- mocker.patch(
- "app.models.service.Service.email_branding_id",
- new_callable=PropertyMock,
- return_value=branding_id,
- )
-
- options = get_email_choices(service)
- assert list(options) == expected_options
-
-
-@pytest.mark.parametrize(
- ("branding_name", "expected_options"),
- [
- (
- "gsa.gov and something else",
- [
- ("govuk", "GOV.UK"),
- ("govuk_and_org", "GOV.UK and Test Organization"),
- ("organization", "Test Organization"),
- ],
- ),
- (
- "gsa.gov and test OrganisatioN",
- [
- ("govuk", "GOV.UK"),
- ("organization", "Test Organization"),
- ],
- ),
- ],
-)
-@pytest.mark.skip(reason="Update for TTS")
-def test_get_email_choices_branding_name_in_use(
- mocker,
- service_one,
- branding_name,
- expected_options,
- mock_get_service_organization,
-):
- service = Service(service_one)
-
- mocker.patch(
- "app.organizations_client.get_organization",
- return_value=organization_json(organization_type="central"),
- )
- mocker.patch(
- "app.models.service.Service.email_branding_id",
- new_callable=PropertyMock,
- return_value="some-branding-id",
- )
- mocker.patch(
- "app.email_branding_client.get_email_branding",
- return_value=create_email_branding("_id", {"name": branding_name}),
- )
-
- options = get_email_choices(service)
- # don't show option if its name is similar to current branding
- assert list(options) == expected_options
diff --git a/tests/conftest.py b/tests/conftest.py
index 9d55b796b..aa679aff6 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -2182,152 +2182,6 @@ def mock_send_already_registered_email(mocker):
return mocker.patch("app.user_api_client.send_already_registered_email")
-def create_email_brandings(
- number_of_brandings, non_standard_values=None, shuffle=False
-):
- brandings = [
- {
- "id": str(idx),
- "name": "org {}".format(idx),
- "text": "org {}".format(idx),
- "colour": None,
- "logo": "logo{}.png".format(idx),
- "brand_type": "org",
- }
- for idx in range(1, number_of_brandings + 1)
- ]
-
- for idx, row in enumerate(non_standard_values or {}):
- brandings[row["idx"]].update(non_standard_values[idx])
-
- if shuffle:
- brandings.insert(3, brandings.pop(4))
-
- return brandings
-
-
-@pytest.fixture()
-def mock_get_all_email_branding(mocker):
- def _get_all_email_branding(sort_key=None):
- non_standard_values = [
- {"idx": 1, "colour": "red"},
- {"idx": 2, "colour": "orange"},
- {"idx": 3, "text": None},
- {"idx": 4, "colour": "blue"},
- ]
- shuffle = sort_key is None
- return create_email_brandings(
- 5, non_standard_values=non_standard_values, shuffle=shuffle
- )
-
- return mocker.patch(
- "app.notify_client.email_branding_client.email_branding_client.get_all_email_branding",
- side_effect=_get_all_email_branding,
- )
-
-
-@pytest.fixture()
-def mock_no_email_branding(mocker):
- def _get_email_branding():
- return []
-
- return mocker.patch(
- "app.email_branding_client.get_all_email_branding",
- side_effect=_get_email_branding,
- )
-
-
-def create_email_branding(id, non_standard_values=None):
- branding = {
- "logo": "example.png",
- "name": "Organization name",
- "text": "Organization text",
- "id": id,
- "colour": "#f00",
- "brand_type": "org",
- }
-
- if non_standard_values:
- branding.update(non_standard_values)
-
- return {"email_branding": branding}
-
-
-@pytest.fixture()
-def mock_get_email_branding(mocker, fake_uuid):
- def _get_email_branding(id):
- return create_email_branding(fake_uuid)
-
- return mocker.patch(
- "app.email_branding_client.get_email_branding", side_effect=_get_email_branding
- )
-
-
-@pytest.fixture()
-def mock_get_email_branding_with_govuk_brand_type(mocker, fake_uuid):
- def _get_email_branding(id):
- return create_email_branding(fake_uuid, {"brand_type": "govuk"})
-
- return mocker.patch(
- "app.email_branding_client.get_email_branding", side_effect=_get_email_branding
- )
-
-
-@pytest.fixture()
-def mock_get_email_branding_with_both_brand_type(mocker, fake_uuid):
- def _get_email_branding(id):
- return create_email_branding(fake_uuid, {"brand_type": "both"})
-
- return mocker.patch(
- "app.email_branding_client.get_email_branding", side_effect=_get_email_branding
- )
-
-
-@pytest.fixture()
-def mock_get_email_branding_with_org_banner_brand_type(mocker, fake_uuid):
- def _get_email_branding(id):
- return create_email_branding(fake_uuid, {"brand_type": "org_banner"})
-
- return mocker.patch(
- "app.email_branding_client.get_email_branding", side_effect=_get_email_branding
- )
-
-
-@pytest.fixture()
-def mock_get_email_branding_without_brand_text(mocker, fake_uuid):
- def _get_email_branding_without_brand_text(id):
- return create_email_branding(
- fake_uuid, {"text": "", "brand_type": "org_banner"}
- )
-
- return mocker.patch(
- "app.email_branding_client.get_email_branding",
- side_effect=_get_email_branding_without_brand_text,
- )
-
-
-@pytest.fixture()
-def mock_create_email_branding(mocker):
- def _create_email_branding(logo, name, text, colour, brand_type):
- return
-
- return mocker.patch(
- "app.email_branding_client.create_email_branding",
- side_effect=_create_email_branding,
- )
-
-
-@pytest.fixture()
-def mock_update_email_branding(mocker):
- def _update_email_branding(branding_id, logo, name, text, colour, brand_type):
- return
-
- return mocker.patch(
- "app.email_branding_client.update_email_branding",
- side_effect=_update_email_branding,
- )
-
-
@pytest.fixture()
def mock_get_guest_list(mocker):
def _get_guest_list(service_id):
diff --git a/tests/javascripts/liveSearch.test.js b/tests/javascripts/liveSearch.test.js
index e0868285e..548e5505f 100644
--- a/tests/javascripts/liveSearch.test.js
+++ b/tests/javascripts/liveSearch.test.js
@@ -25,451 +25,6 @@ describe('Live search', () => {
}
};
- describe("With a list of radios", () => {
-
- searchLabelText = "Search branding styles by name";
-
- beforeEach(() => {
-
- const departmentData = {
- name: 'departments',
- hideLegend: true,
- fields: [
- {
- 'label': 'NHS',
- 'id': 'nhs',
- 'name': 'branding',
- 'value': 'nhs'
- },
- {
- 'label': 'Department for Work and Pensions',
- 'id': 'dwp',
- 'name': 'branding',
- 'value': 'dwp'
- },
- {
- 'label': 'Department for Education',
- 'id': 'dfe',
- 'name': 'branding',
- 'value': 'dfe'
- },
- {
- 'label': 'Home Office',
- 'id': 'home-office',
- 'name': 'branding',
- 'value': 'home-office'
- }
- ]
- };
-
- // set up DOM
- document.body.innerHTML = `
-
-
`;
-
- searchTextbox = document.getElementById('search');
- liveRegion = document.querySelector('.live-search__status');
- list = document.querySelector('form');
-
- // getRadioGroup returns a DOM node so append once DOM is set up
- list.appendChild(helpers.getRadioGroup(departmentData));
-
- });
-
- describe("When the page loads", () => {
-
- test("If there is no search term, the results should be unchanged", () => {
-
- // start the module
- window.GOVUK.modules.start();
-
- const listItems = list.querySelectorAll('.usa-radio');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(listItems.length);
- expect(searchTextbox.hasAttribute('aria-label')).toBe(false);
-
- });
-
- test("If there is a single word search term, only the results that match should show", () => {
-
- searchTextbox.value = 'Department';
-
- // start the module
- window.GOVUK.modules.start();
-
- const listItems = list.querySelectorAll('.usa-radio');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(2);
- expect(searchTextbox.hasAttribute('aria-label')).toBe(true);
- expect(searchTextbox.getAttribute('aria-label')).toEqual(`${searchLabelText}, ${liveRegionResults(2)}`);
-
- });
-
- test("If there is a search term made of several words, only the results that match should show", () => {
-
- searchTextbox.value = 'Department for Work';
-
- // start the module
- window.GOVUK.modules.start();
-
- const listItems = list.querySelectorAll('.usa-radio');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(1);
- expect(searchTextbox.hasAttribute('aria-label')).toBe(true);
- expect(searchTextbox.getAttribute('aria-label')).toEqual(`${searchLabelText}, ${liveRegionResults(1)}`);
-
- });
-
- test("If an item doesn't match the search term but is selected, it should still show in the results", () => {
-
- searchTextbox.value = 'Department for Work';
-
- // mark an item as selected
- checkedItem = list.querySelector('input[id=nhs]');
- checkedItem.checked = true;
-
- // start the module
- window.GOVUK.modules.start();
-
- expect(window.getComputedStyle(checkedItem).display).not.toEqual('none');
-
- });
-
- });
-
- describe("When the search text changes", () => {
-
- test("If there is no search term, the results should be unchanged", () => {
-
- searchTextbox.value = 'Department';
-
- // start the module
- window.GOVUK.modules.start();
-
- // simulate the input of new search text
- searchTextbox.value = '';
- helpers.triggerEvent(searchTextbox, 'input');
-
- const listItems = list.querySelectorAll('.usa-radio');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(listItems.length);
- expect(liveRegion.textContent.trim()).toEqual(liveRegionResults(listItemsShowing.length));
-
- });
-
- test("If there is a single word search term, only the results that match should show", () => {
-
- searchTextbox.value = 'Department';
-
- // start the module
- window.GOVUK.modules.start();
-
- // simulate the input of new search text
- searchTextbox.value = 'Home';
- helpers.triggerEvent(searchTextbox, 'input');
-
- const listItems = list.querySelectorAll('.usa-radio');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(1);
- expect(liveRegion.textContent.trim()).toEqual(liveRegionResults(1));
-
- });
-
- test("If there is a search term made of several words, only the results that match should show", () => {
-
- searchTextbox.value = 'Department';
-
- // start the module
- window.GOVUK.modules.start();
-
- // simulate the input of new search text
- searchTextbox.value = 'Department for';
- helpers.triggerEvent(searchTextbox, 'input');
-
- const listItems = list.querySelectorAll('.usa-radio');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(2);
- expect(liveRegion.textContent.trim()).toEqual(liveRegionResults(2));
-
- });
-
- test("If an item doesn't match the search term but is selected, it should still show in the results", () => {
-
- searchTextbox.value = 'Department';
-
- // mark an item as selected
- checkedItem = list.querySelector('input[id=nhs]');
- checkedItem.checked = true;
-
- // start the module
- window.GOVUK.modules.start();
-
- // simulate the input of new search text
- searchTextbox.value = 'Home Office';
- helpers.triggerEvent(searchTextbox, 'input');
-
- expect(window.getComputedStyle(checkedItem).display).not.toEqual('none');
-
- });
-
- });
-
- });
-
- describe("With a list of checkboxes", () => {
-
- searchLabelText = "Search branding styles by name";
-
- beforeEach(() => {
-
- const templatesAndFolders = [
- {
- "label": "Appointments",
- "type": "folder",
- "meta": "2 templates"
- },
- {
- "label": "New patient",
- "type": "template",
- "meta": "Email template"
- },
- {
- "label": "Prescriptions",
- "type": "folder",
- "meta": "1 template, 1 folder"
- },
- {
- "label": "New doctor",
- "type": "template",
- "meta": "Email template"
- }
- ];
-
- // set up DOM
- document.body.innerHTML = `
-
-
`;
-
- searchTextbox = document.getElementById('search');
- liveRegion = document.querySelector('.live-search__status');
- list = document.querySelector('form');
-
- });
-
- describe("When the page loads", () => {
-
- test("If there is no search term, the results should be unchanged", () => {
-
- // start the module
- window.GOVUK.modules.start();
-
- const listItems = list.querySelectorAll('.template-list-item');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(listItems.length);
- expect(searchTextbox.hasAttribute('aria-label')).toBe(false);
-
- });
-
- test("If there is a single word search term, only the results that match should show", () => {
-
- searchTextbox.value = 'New';
-
- // start the module
- window.GOVUK.modules.start();
-
- const listItems = list.querySelectorAll('.template-list-item');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- // should match 'New patient' and 'New doctor'
- expect(listItemsShowing.length).toEqual(2);
- expect(searchTextbox.hasAttribute('aria-label')).toBe(true);
- expect(searchTextbox.getAttribute('aria-label')).toEqual(`${searchLabelText}, ${liveRegionResults(2)}`);
-
- });
-
- test("If there is a search term made of several words, only the results that match should show", () => {
-
- searchTextbox.value = 'New patient';
-
- // start the module
- window.GOVUK.modules.start();
-
- const listItems = list.querySelectorAll('.template-list-item');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(1);
- expect(searchTextbox.hasAttribute('aria-label')).toBe(true);
- expect(searchTextbox.getAttribute('aria-label')).toEqual(`${searchLabelText}, ${liveRegionResults(1)}`);
-
- });
-
- test("If an item doesn't match the search term but is selected, it should still show in the results", () => {
-
- searchTextbox.value = 'New patient';
-
- // mark 'Appointments' item as selected
- checkedItem = list.querySelector('input[id=templates-or-folder-0]');
- checkedItem.checked = true;
-
- // start the module
- window.GOVUK.modules.start();
-
- // should show despite not matching
- expect(window.getComputedStyle(checkedItem).display).not.toEqual('none');
-
- });
-
- test("If the items have a block of text to match against, only results that match it should show", () => {
-
- searchTextbox.value = 'Email template';
-
- // start the module
- window.GOVUK.modules.start();
-
- const listItems = list.querySelectorAll('.template-list-item');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- // 2 items contain the "Email template" text
- // only the text containing the name of the item is matched against (ie 'New patient')
- expect(listItemsShowing.length).toEqual(0);
- expect(searchTextbox.getAttribute('aria-label')).toEqual(`${searchLabelText}, ${liveRegionResults(0)}`);
-
- });
-
- });
-
- describe("When the search text changes", () => {
-
- test("If there is no search term, the results should be unchanged", () => {
-
- searchTextbox.value = 'Appointments';
-
- // start the module
- window.GOVUK.modules.start();
-
- // simulate input of new search text
- searchTextbox.value = '';
- helpers.triggerEvent(searchTextbox, 'input');
-
- const listItems = list.querySelectorAll('.template-list-item');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(listItems.length);
- expect(liveRegion.textContent.trim()).toEqual(liveRegionResults(listItemsShowing.length));
-
- });
-
- test("If there is a single word search term, only the results that match should show", () => {
-
- searchTextbox.value = 'Appointments';
-
- // start the module
- window.GOVUK.modules.start();
-
- // simulate input of new search text
- searchTextbox.value = 'Prescriptions';
- helpers.triggerEvent(searchTextbox, 'input');
-
- const listItems = list.querySelectorAll('.template-list-item');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(1);
- expect(liveRegion.textContent.trim()).toEqual(liveRegionResults(1));
-
- });
-
- test("If there is a search term made of several words, only the results that match should show", () => {
-
- searchTextbox.value = 'Appointments';
-
- // start the module
- window.GOVUK.modules.start();
-
- // simulate input of new search text
- searchTextbox.value = 'New doctor';
- helpers.triggerEvent(searchTextbox, 'input');
-
- const listItems = list.querySelectorAll('.template-list-item');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- expect(listItemsShowing.length).toEqual(1);
- expect(liveRegion.textContent.trim()).toEqual(liveRegionResults(1));
-
- });
-
- test("If an item doesn't match the search term but is selected, it should still show in the results", () => {
-
- searchTextbox.value = 'Appointments';
-
- // mark 'Appointments' item as selected
- checkedItem = list.querySelector('input[id=templates-or-folder-0]');
- checkedItem.checked = true;
-
- // start the module
- window.GOVUK.modules.start();
-
- // simulate input of new search text
- searchTextbox.value = 'Prescriptions';
- helpers.triggerEvent(searchTextbox, 'input');
-
- // should show despite not matching
- expect(window.getComputedStyle(checkedItem).display).not.toEqual('none');
-
- });
-
- test("If the items have a block of text to match against, only results that match it should show", () => {
-
- searchTextbox.value = 'Appointments';
-
- // start the module
- window.GOVUK.modules.start();
-
- // simulate input of new search text
- searchTextbox.value = 'Email template';
- helpers.triggerEvent(searchTextbox, 'input');
-
- const listItems = list.querySelectorAll('.template-list-item');
- const listItemsShowing = Array.from(listItems).filter(item => window.getComputedStyle(item).display !== 'none');
-
- // 2 items contain the "Email template" text
- // only the text containing the name of the item is matched against (ie 'New patient')
- expect(listItemsShowing.length).toEqual(0);
- expect(liveRegion.textContent.trim()).toEqual(liveRegionResults(0));
-
- });
-
- });
-
- })
-
describe("With a list of content items", () => {
searchLabelText = "Search by name or email address";
diff --git a/tests/javascripts/previewPane.test.js b/tests/javascripts/previewPane.test.js
deleted file mode 100644
index beacaa0cb..000000000
--- a/tests/javascripts/previewPane.test.js
+++ /dev/null
@@ -1,234 +0,0 @@
-const helpers = require('./support/helpers.js');
-
-const emailPageURL = '/services/6658542f-0cad-491f-bec8-ab8457700ead/service-settings/set-email-branding';
-const emailPreviewConfirmationURL = '/services/6658542f-0cad-491f-bec8-ab8457700ead/service-settings/preview-email-branding';
-const letterPageURL = '/services/6658542f-0cad-491f-bec8-ab8457700ead/service-settings/set-letter-branding';
-const letterPreviewConfirmationURL = '/services/6658542f-0cad-491f-bec8-ab8457700ead/service-settings/preview-letter-branding';
-
-let locationMock;
-
-beforeAll(() => {
-
- // mock calls to window.location
- // default to the email page, the pathname can be changed inside specific tests
- locationMock = new helpers.LocationMock(emailPageURL);
-
-});
-
-afterAll(() => {
-
- // reset window.location to its original state
- locationMock.reset();
- require('./support/teardown.js');
-
-});
-
-describe('Preview pane', () => {
-
- let form;
- let radios;
-
- beforeEach(() => {
-
- const brands = {
- "name": "branding_style",
- "label": "Branding style",
- "cssClasses": [],
- "fields": [
- {
- "label": "Department for Education",
- "value": "dfe",
- "checked": true
- },
- {
- "label": "Home Office",
- "value": "ho",
- "checked": false
- },
- {
- "label": "Her Majesty's Revenue and Customs",
- "value": "hmrc",
- "checked": false
- },
- {
- "label": "Department for Work and Pensions",
- "value": "dwp",
- "checked": false
- }
- ]
- };
-
- // set up DOM
- document.body.innerHTML =
- `
`;
-
- document.querySelector('.govuk-grid-column-full').appendChild(helpers.getRadioGroup(brands));
- form = document.querySelector('form');
- radios = form.querySelector('fieldset');
-
- });
-
- afterEach(() => {
-
- document.body.innerHTML = '';
-
- // we run the previewPane.js script every test
- // the module cache needs resetting each time for the script to execute
- jest.resetModules();
-
- });
-
- describe("If the page type is 'email'", () => {
-
- describe("When the page loads", () => {
-
- test("it should add the preview pane", () => {
-
- // run preview pane script
- require('../../app/assets/javascripts/previewPane.js');
-
- expect(document.querySelector('iframe')).not.toBeNull();
-
- });
-
- test("it should change the form to submit the selection instead of posting to a preview page", () => {
-
- // run preview pane script
- require('../../app/assets/javascripts/previewPane.js');
-
- expect(form.getAttribute('action')).toEqual(emailPreviewConfirmationURL);
-
- });
-
- test("the preview pane should show the page for the selected brand", () => {
-
- // run preview pane script
- require('../../app/assets/javascripts/previewPane.js');
-
- const selectedValue = Array.from(radios.querySelectorAll('input[type=radio]')).filter(radio => radio.checked)[0].value;
-
- expect(document.querySelector('iframe').getAttribute('src')).toEqual(`/_email?branding_style=${selectedValue}`);
-
- });
-
- test("the submit button should change from 'Preview' to 'Save'", () => {
-
- // run preview pane script
- require('../../app/assets/javascripts/previewPane.js');
-
- expect(document.querySelector('button[type=submit]').textContent).toEqual('Save');
-
- });
-
- });
-
- describe("If the selection changes", () => {
-
- test("the page shown should match the selected brand", () => {
-
- // run preview pane script
- require('../../app/assets/javascripts/previewPane.js');
-
- const newSelection = radios.querySelectorAll('input[type=radio]')[1];
-
- helpers.moveSelectionToRadio(newSelection);
-
- expect(document.querySelector('iframe').getAttribute('src')).toEqual(`/_email?branding_style=${newSelection.value}`);
-
- });
-
- });
-
- });
-
- describe("If the page type is 'letter'", () => {
-
- beforeEach(() => {
-
- // set page URL and page type to 'letter'
- window.location.pathname = letterPreviewConfirmationURL;
- form.setAttribute('data-preview-type', 'letter');
-
- });
-
- describe("When the page loads", () => {
-
- test("it should add the preview pane", () => {
-
- // run preview pane script
- require('../../app/assets/javascripts/previewPane.js');
-
- expect(document.querySelector('iframe')).not.toBeNull();
-
- });
-
- test("it should change the form to submit the selection instead of posting to a preview page", () => {
-
- // run preview pane script
- require('../../app/assets/javascripts/previewPane.js');
-
- expect(form.getAttribute('action')).toEqual(letterPreviewConfirmationURL);
-
- });
-
- test("the preview pane should show the page for the selected brand", () => {
-
- // run preview pane script
- require('../../app/assets/javascripts/previewPane.js');
-
- const selectedValue = Array.from(radios.querySelectorAll('input[type=radio]')).filter(radio => radio.checked)[0].value;
-
- expect(document.querySelector('iframe').getAttribute('src')).toEqual(`/_letter?branding_style=${selectedValue}`);
-
- });
-
- test("the submit button should change from 'Preview' to 'Save'", () => {
-
- // run preview pane script
- require('../../app/assets/javascripts/previewPane.js');
-
- expect(document.querySelector('button[type=submit]').textContent).toEqual('Save');
-
- });
-
- });
-
- describe("If the selection changes", () => {
-
- test("the page shown should match the selected brand", () => {
-
- // run preview pane script
- require('../../app/assets/javascripts/previewPane.js');
-
- const newSelection = radios.querySelectorAll('input[type=radio]')[1];
-
- helpers.moveSelectionToRadio(newSelection);
-
- expect(document.querySelector('iframe').getAttribute('src')).toEqual(`/_letter?branding_style=${newSelection.value}`);
-
- });
-
- });
-
- });
-
-});