summaryrefslogtreecommitdiff
path: root/src/mailman/database/tests/test_migrations.py
diff options
context:
space:
mode:
authorBarry Warsaw2015-10-20 22:48:59 -0400
committerBarry Warsaw2015-10-20 22:48:59 -0400
commit5f917c8aec735608cb85195e691fb68fbb835af7 (patch)
tree2a963a102f7610a118cd211711c4df90aada94cd /src/mailman/database/tests/test_migrations.py
parentadb9e3164ee1e19802a4373e76b42b1435d1e687 (diff)
downloadmailman-5f917c8aec735608cb85195e691fb68fbb835af7.tar.gz
mailman-5f917c8aec735608cb85195e691fb68fbb835af7.tar.zst
mailman-5f917c8aec735608cb85195e691fb68fbb835af7.zip
Diffstat (limited to 'src/mailman/database/tests/test_migrations.py')
-rw-r--r--src/mailman/database/tests/test_migrations.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py
index 6f167cd13..91f19bfb2 100644
--- a/src/mailman/database/tests/test_migrations.py
+++ b/src/mailman/database/tests/test_migrations.py
@@ -46,9 +46,9 @@ class TestMigrations(unittest.TestCase):
md = sa.MetaData(bind=config.db.engine)
md.reflect()
# We have circular dependencies between user and address, thus we can't
- # use drop_all() without getting a warning. Setting use_alter to True
+ # use drop_all() without getting a warning. Setting use_alter to True
# on the foreign keys helps SQLAlchemy mark those loops as known.
- for tablename in ("user", "address"):
+ for tablename in ('user', 'address'):
if tablename not in md.tables:
continue
for fk in md.tables[tablename].foreign_keys:
@@ -70,17 +70,19 @@ class TestMigrations(unittest.TestCase):
('test-header-1', 'test-pattern-1'),
('test-header-2', 'test-pattern-2'),
('test-header-3', 'test-pattern-3'),
- ]
- mlist_table = sa.sql.table('mailinglist',
+ ]
+ mlist_table = sa.sql.table(
+ 'mailinglist',
sa.sql.column('id', sa.Integer),
sa.sql.column('header_matches', sa.PickleType)
)
- header_match_table = sa.sql.table('headermatch',
+ header_match_table = sa.sql.table(
+ 'headermatch',
sa.sql.column('mailing_list_id', sa.Integer),
sa.sql.column('header', sa.Unicode),
sa.sql.column('pattern', sa.Unicode),
- )
- # Downgrading
+ )
+ # Downgrading.
config.db.store.execute(mlist_table.insert().values(id=1))
config.db.store.execute(header_match_table.insert().values(
[{'mailing_list_id': 1, 'header': hm[0], 'pattern': hm[1]}
@@ -92,7 +94,7 @@ class TestMigrations(unittest.TestCase):
self.assertEqual(results[0].header_matches, test_header_matches)
self.assertFalse(exists_in_db(config.db.engine, 'headermatch'))
config.db.store.commit()
- # Upgrading
+ # Upgrading.
alembic.command.upgrade(alembic_cfg, '42756496720')
results = config.db.store.execute(
header_match_table.select()).fetchall()