mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-12 16:22:17 -05:00
Migration file for email_branding fields update
This commit is contained in:
27
migrations/versions/0209_email_branding_update.py
Normal file
27
migrations/versions/0209_email_branding_update.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0209_email_branding_update
|
||||
Revises: 84c3b6eb16b3
|
||||
Create Date: 2018-07-25 16:08:15.713656
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = '0209_email_branding_update'
|
||||
down_revision = '84c3b6eb16b3'
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('email_branding', sa.Column('text', sa.String(length=255), nullable=True))
|
||||
op.execute('UPDATE email_branding SET text = name')
|
||||
op.execute('UPDATE email_branding SET name = NULL')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('email_branding', 'text')
|
||||
# ### end Alembic commands ###
|
||||
@@ -22,7 +22,7 @@ def test_get_email_branding_options(admin_request, notify_db, notify_db_session)
|
||||
|
||||
|
||||
def test_get_email_branding_by_id(admin_request, notify_db, notify_db_session):
|
||||
email_branding = EmailBranding(colour='#FFFFFF', logo='/path/image.png', name='My Org')
|
||||
email_branding = EmailBranding(colour='#FFFFFF', logo='/path/image.png', name='Some Org', text='My Org')
|
||||
notify_db.session.add(email_branding)
|
||||
notify_db.session.commit()
|
||||
|
||||
@@ -32,10 +32,11 @@ 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'}
|
||||
assert set(response['email_branding'].keys()) == {'colour', 'logo', 'name', 'id', 'text'}
|
||||
assert response['email_branding']['colour'] == '#FFFFFF'
|
||||
assert response['email_branding']['logo'] == '/path/image.png'
|
||||
assert response['email_branding']['name'] == 'My Org'
|
||||
assert response['email_branding']['name'] == 'Some Org'
|
||||
assert response['email_branding']['text'] == 'My Org'
|
||||
assert response['email_branding']['id'] == str(email_branding.id)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user