From b3976c360a70435d49009b927eb109fc851f4bed Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 20 Mar 2019 14:14:19 +0000 Subject: [PATCH] Add test for updating default branding --- tests/app/organisation/test_rest.py | 36 ++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/tests/app/organisation/test_rest.py b/tests/app/organisation/test_rest.py index e8569a48b..9fd312d71 100644 --- a/tests/app/organisation/test_rest.py +++ b/tests/app/organisation/test_rest.py @@ -4,7 +4,14 @@ import pytest from app.models import Organisation from app.dao.organisation_dao import dao_add_service_to_organisation, dao_add_user_to_organisation -from tests.app.db import create_domain, create_organisation, create_service, create_user +from tests.app.db import ( + create_domain, + create_email_branding, + create_letter_branding, + create_organisation, + create_service, + create_user, +) def test_get_all_organisations(admin_request, notify_db_session): @@ -224,6 +231,33 @@ def test_update_other_organisation_attributes_doesnt_clear_domains( ] +def test_update_organisation_default_branding( + admin_request, + notify_db_session, +): + + org = create_organisation(name='Test Organisation') + + email_branding = create_email_branding() + letter_branding = create_letter_branding() + + assert org.email_branding is None + assert org.letter_branding is None + + admin_request.post( + 'organisation.update_organisation', + _data={ + 'email_branding_id': str(email_branding.id), + 'letter_branding_id': str(letter_branding.id), + }, + organisation_id=org.id, + _expected_status=204 + ) + + assert org.email_branding == email_branding + assert org.letter_branding == letter_branding + + def test_post_update_organisation_raises_400_on_existing_org_name( admin_request, sample_organisation): org = create_organisation()