Update tests for changes

Removes any checks for branding_type from tests
for set_email_branding page.

Updates tests for email preview page (usually
iframed) so non-default brand_type is got from the
email_branding model instead of a GET param.
This commit is contained in:
Tom Byers
2018-08-29 11:40:55 +01:00
parent 151488fa78
commit 55f5cc8e1e
3 changed files with 64 additions and 64 deletions

View File

@@ -32,9 +32,9 @@ def test_displays_govuk_branding_by_default(client):
assert page.find("a", attrs={"href": "https://www.gov.uk"})
def test_displays_govuk_branding(client):
def test_displays_govuk_branding(client, mock_get_email_branding_with_govuk_brand_type):
response = client.get(url_for('main.email_template', branding_type="govuk", branding_style="1"))
response = client.get(url_for('main.email_template', branding_style="1"))
page = BeautifulSoup(response.data.decode("utf-8"), "html.parser")
@@ -43,14 +43,14 @@ def test_displays_govuk_branding(client):
assert page.find("a", attrs={"href": "https://www.gov.uk"})
def test_displays_both_branding(client, mock_get_email_branding):
def test_displays_both_branding(client, mock_get_email_branding_with_both_brand_type):
response = client.get(url_for('main.email_template', branding_type="both", branding_style="1"))
response = client.get(url_for('main.email_template', branding_style="1"))
page = BeautifulSoup(response.data.decode("utf-8"), "html.parser")
assert response.status_code == 200
mock_get_email_branding.assert_called_once_with('1')
mock_get_email_branding_with_both_brand_type.assert_called_once_with('1')
assert page.find("a", attrs={"href": "https://www.gov.uk"})
assert page.find("img", attrs={"src": re.compile("example.png$")})
@@ -60,7 +60,8 @@ def test_displays_both_branding(client, mock_get_email_branding):
def test_displays_org_branding(client, mock_get_email_branding):
response = client.get(url_for('main.email_template', branding_type="org", branding_style="1"))
# mock_get_email_branding has 'brand_type' of 'org'
response = client.get(url_for('main.email_template', branding_style="1"))
page = BeautifulSoup(response.data.decode("utf-8"), "html.parser")
@@ -74,15 +75,15 @@ def test_displays_org_branding(client, mock_get_email_branding):
.get_text().strip() == 'Organisation text' # brand text is set
def test_displays_org_branding_with_banner(client, mock_get_email_branding):
def test_displays_org_branding_with_banner(
client, mock_get_email_branding_with_org_banner_brand_type):
response = client.get(url_for('main.email_template', branding_type="org_banner",
branding_style="1"))
response = client.get(url_for('main.email_template', branding_style="1"))
page = BeautifulSoup(response.data.decode("utf-8"), "html.parser")
assert response.status_code == 200
mock_get_email_branding.assert_called_once_with('1')
mock_get_email_branding_with_org_banner_brand_type.assert_called_once_with('1')
assert not page.find("a", attrs={"href": "https://www.gov.uk"})
assert page.find("img", attrs={"src": re.compile("example.png")})
@@ -94,8 +95,8 @@ def test_displays_org_branding_with_banner(client, mock_get_email_branding):
def test_displays_org_branding_with_banner_without_brand_text(
client, mock_get_email_branding_without_brand_text):
response = client.get(url_for('main.email_template', branding_type="org_banner",
branding_style="1"))
# mock_get_email_branding_without_brand_text has 'brand_type' of 'org_banner'
response = client.get(url_for('main.email_template', branding_style="1"))
page = BeautifulSoup(response.data.decode("utf-8"), "html.parser")