def test_get_html_email_renderer_handles_email_branding_without_logo( notify_api): Service = namedtuple('Service', ['email_branding']) EmailBranding = namedtuple( 'EmailBranding', ['brand_type', 'colour', 'name', 'logo', 'text']) email_branding = EmailBranding( brand_type=BRANDING_ORG_BANNER, colour='#000000', logo=None, name='Justice League', text='League of Justice', ) service = Service(email_branding=email_branding, ) renderer = send_to_providers.get_html_email_options(service) assert renderer['govuk_banner'] is False assert renderer['brand_banner'] is True assert renderer['brand_logo'] is None assert renderer['brand_text'] == 'League of Justice' assert renderer['brand_colour'] == '#000000' assert renderer['brand_name'] == 'Justice League'
def test_get_html_email_renderer_handles_email_branding_without_logo( notify_api, sample_notification_model_with_organization, mock_email_client ): email_branding = EmailBranding( brand_type=BRANDING_ORG_BANNER, colour='#000000', logo=None, name='Justice League', text='League of Justice', ) sample_notification_model_with_organization.service.email_branding = email_branding renderer = send_to_providers.get_html_email_options(sample_notification_model_with_organization, mock_email_client) assert renderer['default_banner'] is False assert renderer['brand_banner'] is True assert renderer['brand_logo'] is None assert renderer['brand_text'] == 'League of Justice' assert renderer['brand_colour'] == '#000000' assert renderer['brand_name'] == 'Justice League'
def test_get_html_email_renderer_with_branding_details(branding_type, govuk_banner, notify_db, sample_service): email_branding = EmailBranding( brand_type=branding_type, 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() options = send_to_providers.get_html_email_options(sample_service) assert options['govuk_banner'] == govuk_banner assert options['brand_colour'] == '#000000' assert options['brand_text'] == 'League of Justice' assert options['brand_name'] == 'Justice League' if branding_type == BRANDING_ORG_BANNER: assert options['brand_banner'] is True else: assert options['brand_banner'] is False