From 0b0e5516263f9f460aac7e31ba791d090c5dc4ec Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Mon, 20 Aug 2018 10:57:42 +0100 Subject: [PATCH] Add banner_colour, single_id_colour, and domain to email_branding_schema. The Admin app can now be updated to send the new columns to update/create email_branding --- app/email_branding/email_branding_schema.py | 10 ++++++++-- tests/app/email_branding/test_rest.py | 10 +++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/email_branding/email_branding_schema.py b/app/email_branding/email_branding_schema.py index 3da94c985..7a70c70db 100644 --- a/app/email_branding/email_branding_schema.py +++ b/app/email_branding/email_branding_schema.py @@ -4,9 +4,12 @@ post_create_email_branding_schema = { "type": "object", "properties": { "colour": {"type": ["string", "null"]}, + "banner_colour": {"type": ["string", "null"]}, + "single_id_colour": {"type": ["string", "null"]}, "name": {"type": ["string", "null"]}, "text": {"type": ["string", "null"]}, - "logo": {"type": ["string", "null"]} + "logo": {"type": ["string", "null"]}, + "domain": {"type": ["string", "null"]}, }, "required": [] } @@ -17,9 +20,12 @@ post_update_email_branding_schema = { "type": "object", "properties": { "colour": {"type": ["string", "null"]}, + "banner_colour": {"type": ["string", "null"]}, + "single_id_colour": {"type": ["string", "null"]}, "name": {"type": ["string", "null"]}, "text": {"type": ["string", "null"]}, - "logo": {"type": ["string", "null"]} + "logo": {"type": ["string", "null"]}, + "domain": {"type": ["string", "null"]}, }, "required": [] } diff --git a/tests/app/email_branding/test_rest.py b/tests/app/email_branding/test_rest.py index 1be15c9f2..c27969693 100644 --- a/tests/app/email_branding/test_rest.py +++ b/tests/app/email_branding/test_rest.py @@ -45,7 +45,10 @@ def test_post_create_email_branding(admin_request, notify_db_session): data = { 'name': 'test email_branding', 'colour': '#0000ff', - 'logo': '/images/test_x2.png' + 'banner_colour': '#808080', + 'single_id_colour': '#FF0000', + 'logo': '/images/test_x2.png', + 'domain': 'gov.uk' } response = admin_request.post( 'email_branding.create_email_branding', @@ -54,8 +57,11 @@ def test_post_create_email_branding(admin_request, notify_db_session): ) assert data['name'] == response['data']['name'] assert data['colour'] == response['data']['colour'] + assert data['banner_colour'] == response['data']['banner_colour'] + assert data['single_id_colour'] == response['data']['single_id_colour'] assert data['logo'] == response['data']['logo'] assert data['name'] == response['data']['text'] + assert data['domain'] == response['data']['domain'] def test_post_create_email_branding_without_logo_is_ok(admin_request, notify_db_session): @@ -142,6 +148,8 @@ def test_post_create_email_branding_with_text_as_none_and_name(admin_request, no @pytest.mark.parametrize('data_update', [ ({'name': 'test email_branding 1'}), ({'logo': 'images/text_x3.png', 'colour': '#ffffff'}), + ({'logo': 'images/text_x3.png', 'banner_colour': '#ffffff', 'single_id_colour': '#808080'}), + ({'logo': 'images/text_x3.png', 'banner_colour': '#ffffff', 'single_id_colour': '#808080', 'domain': 'gov.uk'}), ]) def test_post_update_email_branding_updates_field(admin_request, notify_db_session, data_update): data = {