mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
Removing platform_default as a concept. No service actually wants to send letters with the default hm-government logo so we are going to remove it as a constraint.
However, until we can create a letter without a logo, we will still default to hm-government, because the dvla_organisation is set on the service. This does simplify the code. Also removed the inserts to letter_branding in the data migration file, because we can deploy this before the rest of the work is finished. But we will need to do it later.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from app.dao.letter_branding_dao import (
|
||||
dao_get_letter_branding_or_platform_default,
|
||||
dao_get_letter_branding_by_domain,
|
||||
dao_get_all_letter_branding,
|
||||
dao_create_letter_branding,
|
||||
dao_update_letter_branding
|
||||
@@ -8,36 +8,29 @@ from app.models import LetterBranding
|
||||
from tests.app.db import create_letter_branding
|
||||
|
||||
|
||||
def test_dao_get_letter_branding_or_platform_default_returns_platform_default_if_domain_is_none(notify_db_session):
|
||||
create_letter_branding()
|
||||
result = dao_get_letter_branding_or_platform_default(domain=None)
|
||||
assert result.filename == 'hm-government'
|
||||
def test_dao_get_letter_branding_by_domain_returns_none_if_no_matching_domains(notify_db_session):
|
||||
result = dao_get_letter_branding_by_domain(domain="test.domain")
|
||||
assert not result
|
||||
|
||||
|
||||
def test_dao_get_letter_branding_or_platform_default_if_domain_is_not_associated_with_a_brand(notify_db_session):
|
||||
create_letter_branding()
|
||||
result = dao_get_letter_branding_or_platform_default(domain="foo.bar")
|
||||
assert result.filename == 'hm-government'
|
||||
|
||||
|
||||
def test_dao_get_letter_branding_or_platform_default_returns_correct_brand_for_domain(notify_db_session):
|
||||
create_letter_branding()
|
||||
def test_dao_get_letter_branding_by_domain_returns_correct_brand_for_domain(notify_db_session):
|
||||
create_letter_branding(domain='gov.uk')
|
||||
test_domain_branding = create_letter_branding(
|
||||
name='test domain', filename='test-domain', domain='test.domain', platform_default=False
|
||||
name='test domain', filename='test-domain', domain='test.domain'
|
||||
)
|
||||
result = dao_get_letter_branding_or_platform_default(domain='test.domain')
|
||||
result = dao_get_letter_branding_by_domain(domain='test.domain')
|
||||
result == test_domain_branding
|
||||
|
||||
|
||||
def test_dao_get_all_letter_branding(notify_db_session):
|
||||
platform_default = create_letter_branding()
|
||||
hm_gov = create_letter_branding()
|
||||
test_domain = create_letter_branding(
|
||||
name='test domain', filename='test-domain', domain='test.domain', platform_default=False
|
||||
name='test domain', filename='test-domain', domain='test.domain'
|
||||
)
|
||||
|
||||
results = dao_get_all_letter_branding()
|
||||
|
||||
assert platform_default in results
|
||||
assert hm_gov in results
|
||||
assert test_domain in results
|
||||
assert len(results) == 2
|
||||
|
||||
@@ -61,7 +54,6 @@ def test_dao_create_letter_branding(notify_db_session):
|
||||
assert new_letter_branding.name == data['name']
|
||||
assert new_letter_branding.domain == data['domain']
|
||||
assert new_letter_branding.filename == data['name']
|
||||
assert not new_letter_branding.platform_default
|
||||
|
||||
|
||||
def test_dao_update_letter_branding(notify_db_session):
|
||||
|
||||
@@ -106,7 +106,7 @@ def test_create_service_with_letter_branding(notify_db_session):
|
||||
user = create_user()
|
||||
create_letter_branding()
|
||||
letter_branding = create_letter_branding(
|
||||
name='test domain', filename='test-domain', domain='test.domain', platform_default=False
|
||||
name='test domain', filename='test-domain', domain='test.domain'
|
||||
)
|
||||
assert Service.query.count() == 0
|
||||
service = Service(name="service_name",
|
||||
|
||||
Reference in New Issue
Block a user