Remove domain columns from branding table

This relationship is via the `Organisation` now; we don’t use this
column to fudge a relationship based on the user’s email address and the
matching something in these columns.
This commit is contained in:
Chris Hill-Scott
2019-04-12 15:53:17 +01:00
parent a39ed098b8
commit ee966668bd
14 changed files with 23 additions and 195 deletions
+2 -8
View File
@@ -53,13 +53,7 @@ def test_update_email_branding(notify_db, notify_db_session):
assert email_branding[0].name == updated_name
def test_domain_cant_be_empty_string(notify_db, notify_db_session):
def test_email_branding_has_no_domain(notify_db, notify_db_session):
create_email_branding()
email_branding = EmailBranding.query.all()
assert email_branding[0].domain is None
dao_update_email_branding(email_branding[0], domain='')
email_branding = EmailBranding.query.all()
assert email_branding[0].domain is None
assert not hasattr(email_branding, 'domain')
+3 -20
View File
@@ -4,7 +4,6 @@ import pytest
from sqlalchemy.exc import SQLAlchemyError
from app.dao.letter_branding_dao import (
dao_get_letter_branding_by_domain,
dao_get_all_letter_branding,
dao_create_letter_branding,
dao_update_letter_branding,
@@ -26,30 +25,16 @@ def test_dao_get_letter_brand_by_id_raises_exception_if_does_not_exist(notify_db
dao_get_letter_branding_by_id(uuid.uuid4())
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_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'
)
result = dao_get_letter_branding_by_domain(domain='test.domain')
result == test_domain_branding
def test_dao_get_all_letter_branding(notify_db_session):
hm_gov = create_letter_branding()
test_domain = create_letter_branding(
name='test domain', filename='test-domain', domain='test.domain'
test_branding = create_letter_branding(
name='test branding', filename='test-branding',
)
results = dao_get_all_letter_branding()
assert hm_gov in results
assert test_domain in results
assert test_branding in results
assert len(results) == 2
@@ -60,7 +45,6 @@ def test_dao_get_all_letter_branding_returns_empty_list_if_no_brands_exist(notif
def test_dao_create_letter_branding(notify_db_session):
data = {
'name': 'test-logo',
'domain': 'test.co.uk',
'filename': 'test-logo'
}
assert LetterBranding.query.count() == 0
@@ -70,7 +54,6 @@ def test_dao_create_letter_branding(notify_db_session):
new_letter_branding = LetterBranding.query.first()
assert new_letter_branding.name == data['name']
assert new_letter_branding.domain == data['domain']
assert new_letter_branding.filename == data['name']
+1 -1
View File
@@ -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'
name='test domain', filename='test-domain',
)
assert Service.query.count() == 0
service = Service(name="service_name",