M byceps/services/email/models.py => byceps/services/email/models.py +1 -1
@@ 19,7 19,7 @@ class EmailConfig(db.Model):
__tablename__ = 'email_configs'
id = db.Column(db.UnicodeText, primary_key=True)
- brand_id = db.Column(db.UnicodeText, db.ForeignKey('brands.id'), index=True, nullable=False)
+ brand_id = db.Column(db.UnicodeText, db.ForeignKey('brands.id'), index=True, unique=True, nullable=False)
sender_address = db.Column(db.UnicodeText, nullable=False)
sender_name = db.Column(db.UnicodeText, nullable=True)
contact_address = db.Column(db.UnicodeText, nullable=True)
M tests/integration/blueprints/admin/email/test_create_config.py => tests/integration/blueprints/admin/email/test_create_config.py +6 -2
@@ 6,7 6,9 @@
import byceps.services.email.service as email_service
-def test_create_minimal_config(email_admin_client, brand):
+def test_create_minimal_config(email_admin_client, make_brand):
+ brand = make_brand('acme-create-1', 'ACME create test 1')
+
config_id = 'acme-minimal'
assert email_service.find_config(config_id) is None
@@ 31,7 33,9 @@ def test_create_minimal_config(email_admin_client, brand):
email_service.delete_config(config_id)
-def test_create_full_config(email_admin_client, brand):
+def test_create_full_config(email_admin_client, make_brand):
+ brand = make_brand('acme-create-2', 'ACME create test 2')
+
config_id = 'acme-full'
assert email_service.find_config(config_id) is None
M tests/integration/blueprints/admin/email/test_delete_config.py => tests/integration/blueprints/admin/email/test_delete_config.py +3 -1
@@ 6,9 6,11 @@
import byceps.services.email.service as email_service
-def test_delete_config(email_admin_client, brand):
+def test_delete_config(email_admin_client, make_brand):
config_id = 'kann-weg'
+ brand = make_brand('acme-delete', 'ACME deletion test')
+
assert email_service.create_config(
config_id, brand.id, 'noreply@acme.example'
)
M tests/integration/blueprints/site/user_message/test_send.py => tests/integration/blueprints/site/user_message/test_send.py +6 -2
@@ 13,7 13,9 @@ from tests.helpers import create_site, http_client, login_user
@pytest.fixture(scope='module')
-def site1(brand, make_email_config):
+def site1(make_brand, make_email_config):
+ brand = make_brand('acme-brand-1', 'ACME Brand 1')
+
email_config = make_email_config(
'acme-noreply',
brand.id,
@@ 35,7 37,9 @@ def site1(brand, make_email_config):
@pytest.fixture(scope='module')
-def site2(brand, make_email_config):
+def site2(make_brand, make_email_config):
+ brand = make_brand('acme-brand-2', 'ACME Brand 2')
+
email_config = make_email_config(
'acme-noreply-with-contact-address',
brand.id,