Merge branch 'master' into add-brand-type-to-email-branding

This commit is contained in:
Rebecca Law
2018-08-24 11:09:31 +01:00
18 changed files with 246 additions and 141 deletions

View File

@@ -278,6 +278,34 @@ def test_conversation_reply_shows_templates(
)
def test_conversation_reply_shows_live_search_if_list_of_templates_taller_than_screen(
client_request,
fake_uuid,
mock_get_more_service_templates_than_can_fit_onscreen,
):
page = client_request.get(
'main.conversation_reply',
service_id=SERVICE_ONE_ID,
notification_id=fake_uuid,
)
assert page.select('.live-search')
def test_conversation_reply_shows_live_search_if_list_of_templates_fits_onscreen(
client_request,
fake_uuid,
mock_get_service_templates,
):
page = client_request.get(
'main.conversation_reply',
service_id=SERVICE_ONE_ID,
notification_id=fake_uuid,
)
assert not page.select('.live-search')
def test_conversation_reply_redirects_with_phone_number_from_notification(
client_request,
fake_uuid,

View File

@@ -20,19 +20,26 @@ def test_email_branding_page_shows_full_branding_list(
assert response.status_code == 200
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
radio_labels = page.select('div.multiple-choice > label')
brand_names = [element.get_text().strip() for idx, element in enumerate(radio_labels)]
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
) == "Select an email branding to update or create a new email branding"
) == "Email branding"
assert page.select_one('.column-three-quarters a')['href'] == url_for('main.create_email_branding')
first_label = radio_labels[0]
assert normalize_spaces(first_label.text) == 'org 1'
assert brand_names == [
'org 1', 'org 2', 'org 3', 'org 4', 'org 5', 'Create a new email branding']
assert normalize_spaces((radio_labels[-1]).text) == 'Create a new email branding'
'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(

View File

@@ -1782,6 +1782,34 @@ def test_should_show_branding_styles(
app.service_api_client.get_service.assert_called_once_with(service_one['id'])
def test_should_show_live_search_if_list_of_brand_styles_fits_onscreen(
logged_in_platform_admin_client,
service_one,
mock_get_email_branding_that_can_fit_onscreen,
):
response = logged_in_platform_admin_client.get(url_for(
'main.service_set_email_branding', service_id=service_one['id']
))
assert response.status_code == 200
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert not page.select('.live-search')
def test_should_show_live_search_if_list_of_brand_styles_taller_than_page(
logged_in_platform_admin_client,
service_one,
mock_get_more_email_branding_than_can_fit_onscreen,
):
response = logged_in_platform_admin_client.get(url_for(
'main.service_set_email_branding', service_id=service_one['id']
))
assert response.status_code == 200
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert page.select('.live-search')
def test_should_send_branding_and_organisations_to_preview(
logged_in_platform_admin_client,
service_one,

View File

@@ -147,6 +147,32 @@ def test_should_not_show_template_nav_if_only_one_type_of_template(
assert not page.select('.pill')
def test_should_not_show_live_search_if_list_of_templates_fits_onscreen(
client_request,
mock_get_service_templates
):
page = client_request.get(
'main.choose_template',
service_id=SERVICE_ONE_ID,
)
assert not page.select('.live-search')
def test_should_show_live_search_if_list_of_templates_taller_than_screen(
client_request,
mock_get_more_service_templates_than_can_fit_onscreen
):
page = client_request.get(
'main.choose_template',
service_id=SERVICE_ONE_ID,
)
assert page.select('.live-search')
def test_should_show_page_for_one_template(
logged_in_client,
mock_get_service_template,