mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 15:18:26 -04:00
Fix the EmailBranding
This commit is contained in:
@@ -51,8 +51,6 @@ def test_edit_email_branding_shows_the_correct_branding_info(
|
||||
assert page.select_one('#name').attrs.get('value') == 'Organisation name'
|
||||
assert page.select_one('#text').attrs.get('value') == 'Organisation text'
|
||||
assert page.select_one('#colour').attrs.get('value') == '#f00'
|
||||
assert page.select_one('#banner_colour').attrs.get('value') == '#f11'
|
||||
assert page.select_one('#single_id_colour').attrs.get('value') == '#f22'
|
||||
assert page.select_one('#domain').attrs.get('value') == 'sample.com'
|
||||
|
||||
|
||||
@@ -72,8 +70,6 @@ def test_create_email_branding_does_not_show_any_branding_info(
|
||||
assert page.select_one('#name').attrs.get('value') == ''
|
||||
assert page.select_one('#text').attrs.get('value') == ''
|
||||
assert page.select_one('#colour').attrs.get('value') == ''
|
||||
assert page.select_one('#banner_colour').attrs.get('value') == ''
|
||||
assert page.select_one('#single_id_colour').attrs.get('value') == ''
|
||||
assert page.select_one('#domain').attrs.get('value') == ''
|
||||
|
||||
|
||||
@@ -89,8 +85,7 @@ def test_create_new_email_branding_without_logo(
|
||||
'text': 'new text',
|
||||
'name': 'new name',
|
||||
'domain': 'sample.com',
|
||||
'banner_colour': '#FFFF00',
|
||||
'single_id_colour': '#00FF00',
|
||||
'brand_type': 'govuk'
|
||||
}
|
||||
|
||||
mock_persist = mocker.patch('app.main.views.email_branding.persist_logo')
|
||||
@@ -108,9 +103,8 @@ def test_create_new_email_branding_without_logo(
|
||||
name=data['name'],
|
||||
text=data['text'],
|
||||
colour=data['colour'],
|
||||
banner_colour=data['banner_colour'],
|
||||
single_id_colour=data['single_id_colour'],
|
||||
domain=data['domain']
|
||||
domain=data['domain'],
|
||||
brand_type=data['brand_type']
|
||||
)
|
||||
assert mock_persist.call_args_list == []
|
||||
|
||||
@@ -130,8 +124,7 @@ def test_create_new_email_branding_when_branding_saved(
|
||||
'text': 'new text',
|
||||
'name': 'new name',
|
||||
'domain': 'sample.com',
|
||||
'banner_colour': '#FFFF00',
|
||||
'single_id_colour': '#00FF00',
|
||||
'brand_type': 'govuk'
|
||||
}
|
||||
|
||||
temp_filename = LOGO_LOCATION_STRUCTURE.format(
|
||||
@@ -152,8 +145,7 @@ def test_create_new_email_branding_when_branding_saved(
|
||||
'text': data['text'],
|
||||
'cdn_url': 'https://static-logos.cdn.com',
|
||||
'domain': data['domain'],
|
||||
'banner_colour': data['banner_colour'],
|
||||
'single_id_colour': data['single_id_colour'],
|
||||
'brand_type': data['brand_type']
|
||||
}
|
||||
)
|
||||
|
||||
@@ -163,9 +155,8 @@ def test_create_new_email_branding_when_branding_saved(
|
||||
name=data['name'],
|
||||
text=data['text'],
|
||||
colour=data['colour'],
|
||||
banner_colour=data['banner_colour'],
|
||||
single_id_colour=data['single_id_colour'],
|
||||
domain=data['domain']
|
||||
domain=data['domain'],
|
||||
brand_type=data['brand_type']
|
||||
)
|
||||
|
||||
|
||||
@@ -207,7 +198,9 @@ def test_deletes_previous_temp_logo_after_uploading_logo(
|
||||
|
||||
logged_in_platform_admin_client.post(
|
||||
url_for('main.create_email_branding', logo=temp_old_filename, branding_id=fake_uuid),
|
||||
data={'file': (BytesIO(''.encode('utf-8')), 'test.png')},
|
||||
data={'file': (BytesIO(''.encode('utf-8')), 'test.png'),
|
||||
'brand_type': 'govuk'
|
||||
},
|
||||
content_type='multipart/form-data'
|
||||
)
|
||||
|
||||
@@ -231,9 +224,8 @@ def test_update_existing_branding(
|
||||
'colour': '#0000ff',
|
||||
'text': 'new text',
|
||||
'name': 'new name',
|
||||
'banner_colour': '#FFFF00',
|
||||
'single_id_colour': '#00FF00',
|
||||
'domain': 'sample.com',
|
||||
'brand_type': 'govuk'
|
||||
}
|
||||
|
||||
temp_filename = LOGO_LOCATION_STRUCTURE.format(
|
||||
@@ -250,8 +242,7 @@ def test_update_existing_branding(
|
||||
content_type='multipart/form-data',
|
||||
data={'colour': data['colour'], 'name': data['name'], 'text': data['text'],
|
||||
'cdn_url': 'https://static-logos.cdn.com',
|
||||
'banner_colour': data['banner_colour'], 'single_id_colour': data['single_id_colour'],
|
||||
'domain': data['domain']
|
||||
'domain': data['domain'], 'brand_type': data['brand_type']
|
||||
}
|
||||
)
|
||||
|
||||
@@ -262,9 +253,8 @@ def test_update_existing_branding(
|
||||
name=data['name'],
|
||||
text=data['text'],
|
||||
colour=data['colour'],
|
||||
banner_colour=data['banner_colour'],
|
||||
single_id_colour=data['single_id_colour'],
|
||||
domain=data['domain'],
|
||||
brand_type=data['brand_type']
|
||||
)
|
||||
|
||||
|
||||
@@ -287,7 +277,8 @@ def test_temp_logo_is_shown_after_uploading_logo(
|
||||
|
||||
response = logged_in_platform_admin_client.post(
|
||||
url_for('main.create_email_branding'),
|
||||
data={'file': (BytesIO(''.encode('utf-8')), 'test.png')},
|
||||
data={'file': (BytesIO(''.encode('utf-8')), 'test.png'),
|
||||
'brand_type': 'govuk'},
|
||||
content_type='multipart/form-data',
|
||||
follow_redirects=True
|
||||
)
|
||||
@@ -317,9 +308,9 @@ def test_logo_persisted_when_organisation_saved(
|
||||
|
||||
resp = logged_in_platform_admin_client.post(
|
||||
url_for('.create_email_branding', logo=temp_filename),
|
||||
data={'brand_type': 'govuk'},
|
||||
content_type='multipart/form-data'
|
||||
)
|
||||
|
||||
assert resp.status_code == 302
|
||||
|
||||
assert not mocked_upload_logo.called
|
||||
@@ -348,8 +339,7 @@ def test_colour_regex_validation(
|
||||
'text': 'new text',
|
||||
'name': 'new name',
|
||||
'domain': 'sample.com',
|
||||
'banner_colour': '#FFFF00',
|
||||
'single_id_colour': '#00FF00',
|
||||
'brand_type': 'govuk'
|
||||
}
|
||||
|
||||
mocker.patch('app.main.views.email_branding.delete_temp_files_created_by')
|
||||
@@ -359,5 +349,4 @@ def test_colour_regex_validation(
|
||||
content_type='multipart/form-data',
|
||||
data=data
|
||||
)
|
||||
|
||||
assert response.status_code == expected_status_code
|
||||
|
||||
Reference in New Issue
Block a user