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
This commit is contained in:
Rebecca Law
2018-08-16 16:57:53 +01:00
parent 025f805992
commit df2271a49f
2 changed files with 8 additions and 1 deletions

View File

@@ -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

View File

@@ -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'