From df2271a49f1e74bdaa4c27056cc5b1dbf412901e Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Thu, 16 Aug 2018 16:57:53 +0100 Subject: [PATCH] New columns for EmailBranding. There is a requirement for the colour of the banner to be different to the single id colour. In order to accomodate that we are adding two new columns for that data. These columns will be updated manually and not done with a data migration. A new column called domain has been added. This will be used as a default domain, if the user that creates the service has a matching domain this email brand will be set for the service. This PR only adds the new columns to the model and db. https://www.pivotaltracker.com/story/show/159660295 --- app/models.py | 6 ++++++ tests/app/email_branding/test_rest.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models.py b/app/models.py index 665761789..fa62a6a04 100644 --- a/app/models.py +++ b/app/models.py @@ -203,9 +203,12 @@ class EmailBranding(db.Model): __tablename__ = 'email_branding' id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) colour = db.Column(db.String(7), nullable=True) + banner_colour = db.Column(db.String(7), nullable=True) + single_id_colour = db.Column(db.String(7), nullable=True) logo = db.Column(db.String(255), nullable=True) name = db.Column(db.String(255), nullable=True) text = db.Column(db.String(255), nullable=True) + domain = db.Column(db.Text, nullable=True) def serialize(self): serialized = { @@ -214,6 +217,9 @@ class EmailBranding(db.Model): "logo": self.logo, "name": self.name, "text": self.text, + "banner_colour": self.banner_colour, + "single_id_colour": self.single_id_colour, + "domain": self.domain } return serialized diff --git a/tests/app/email_branding/test_rest.py b/tests/app/email_branding/test_rest.py index 0661a6f2c..1be15c9f2 100644 --- a/tests/app/email_branding/test_rest.py +++ b/tests/app/email_branding/test_rest.py @@ -32,7 +32,8 @@ def test_get_email_branding_by_id(admin_request, notify_db, notify_db_session): email_branding_id=email_branding.id ) - assert set(response['email_branding'].keys()) == {'colour', 'logo', 'name', 'id', 'text'} + assert set(response['email_branding'].keys()) == {'colour', 'logo', 'name', 'id', 'text', + 'banner_colour', 'single_id_colour', 'domain'} assert response['email_branding']['colour'] == '#FFFFFF' assert response['email_branding']['logo'] == '/path/image.png' assert response['email_branding']['name'] == 'Some Org'