mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
Add unique constraint to email branding domains
Does two things:
1. Revert "Revert "Add unique constraint to email branding domain""
This reverts commit af9cb30ef3.
2. Don’t allow empty string in email branding domain
Columns with multiple `null`s can have a uniqueness constraint. Columns
with multiple empty string values are not considered unique.
This commit:
- removes any duplicate empty string values
- casts empty strings to null string any time these columns are updated
---
Squashed into this single commits because these two things are not
atomic as individual commits.
This commit is contained in:
@@ -51,3 +51,15 @@ def test_update_email_branding(notify_db, notify_db_session):
|
||||
|
||||
assert len(email_branding) == 1
|
||||
assert email_branding[0].name == updated_name
|
||||
|
||||
|
||||
def test_domain_cant_be_empty_string(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
|
||||
|
||||
Reference in New Issue
Block a user