From 69ab6492564184fa618b38ebf0be566e21d1b593 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Mon, 13 Aug 2018 10:29:06 +0100 Subject: [PATCH] Use the EmailBranding.text for the bannder instead of the name. --- app/delivery/send_to_providers.py | 2 +- tests/app/delivery/test_send_to_providers.py | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index 7167202db..c285c00e2 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -201,7 +201,7 @@ def get_html_email_options(service): branding = { 'brand_colour': service.email_branding.colour, 'brand_logo': logo_url, - 'brand_name': service.email_branding.name, + 'brand_name': service.email_branding.text, } else: branding = {} diff --git a/tests/app/delivery/test_send_to_providers.py b/tests/app/delivery/test_send_to_providers.py index 57ed3b50c..15e0abfcf 100644 --- a/tests/app/delivery/test_send_to_providers.py +++ b/tests/app/delivery/test_send_to_providers.py @@ -421,7 +421,8 @@ def test_get_html_email_renderer_should_return_for_normal_service(sample_service ]) def test_get_html_email_renderer_with_branding_details(branding_type, govuk_banner, notify_db, sample_service): sample_service.branding = branding_type - email_branding = EmailBranding(colour='#000000', logo='justice-league.png', name='Justice League') + email_branding = EmailBranding(colour='#000000', logo='justice-league.png', name='Justice League', + text='League of Justice') sample_service.email_branding = email_branding notify_db.session.add_all([sample_service, email_branding]) notify_db.session.commit() @@ -430,7 +431,7 @@ def test_get_html_email_renderer_with_branding_details(branding_type, govuk_bann assert options['govuk_banner'] == govuk_banner assert options['brand_colour'] == '#000000' - assert options['brand_name'] == 'Justice League' + assert options['brand_name'] == 'League of Justice' if sample_service.branding == BRANDING_ORG_BANNER: assert options['brand_banner'] is True @@ -440,7 +441,8 @@ def test_get_html_email_renderer_with_branding_details(branding_type, govuk_bann def test_get_html_email_renderer_with_branding_details_and_render_govuk_banner_only(notify_db, sample_service): sample_service.branding = BRANDING_GOVUK - email_branding = EmailBranding(colour='#000000', logo='justice-league.png', name='Justice League') + email_branding = EmailBranding(colour='#000000', logo='justice-league.png', name='Justice League', + text='League of Justice') sample_service.email_branding = email_branding notify_db.session.add_all([sample_service, email_branding]) notify_db.session.commit() @@ -452,9 +454,11 @@ def test_get_html_email_renderer_with_branding_details_and_render_govuk_banner_o def test_get_html_email_renderer_prepends_logo_path(notify_api): Service = namedtuple('Service', ['branding', 'email_branding']) - EmailBranding = namedtuple('EmailBranding', ['colour', 'name', 'logo']) + EmailBranding = namedtuple('EmailBranding', ['colour', 'name', 'logo', 'text']) - email_branding = EmailBranding(colour='#000000', logo='justice-league.png', name='Justice League') + email_branding = EmailBranding(colour='#000000', logo='justice-league.png', + name='Justice League', + text='League of Justice') service = Service(branding=BRANDING_ORG, email_branding=email_branding) renderer = send_to_providers.get_html_email_options(service) @@ -464,9 +468,9 @@ def test_get_html_email_renderer_prepends_logo_path(notify_api): def test_get_html_email_renderer_handles_email_branding_without_logo(notify_api): Service = namedtuple('Service', ['branding', 'email_branding']) - EmailBranding = namedtuple('EmailBranding', ['colour', 'name', 'logo']) + EmailBranding = namedtuple('EmailBranding', ['colour', 'name', 'logo', 'text']) - email_branding = EmailBranding(colour='#000000', logo=None, name='Justice League') + email_branding = EmailBranding(colour='#000000', logo=None, name='Justice League', text='League of Justice') service = Service(branding=BRANDING_ORG, email_branding=email_branding) renderer = send_to_providers.get_html_email_options(service)