summaryrefslogtreecommitdiff
path: root/src/mailman/database/tests/test_migrations.py
diff options
context:
space:
mode:
authorBarry Warsaw2015-12-19 17:23:56 -0500
committerBarry Warsaw2015-12-19 17:23:56 -0500
commitf2620c6f41c1703e7dce1a44a6669e01aaee326d (patch)
treedbfb5667adc20d540b9897f972346f03007e2af9 /src/mailman/database/tests/test_migrations.py
parent9f14de31ec1f78a2f2847d7a2c9b8efb775adab9 (diff)
downloadmailman-f2620c6f41c1703e7dce1a44a6669e01aaee326d.tar.gz
mailman-f2620c6f41c1703e7dce1a44a6669e01aaee326d.tar.zst
mailman-f2620c6f41c1703e7dce1a44a6669e01aaee326d.zip
Diffstat (limited to 'src/mailman/database/tests/test_migrations.py')
-rw-r--r--src/mailman/database/tests/test_migrations.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py
index 823c94652..e3f4b9581 100644
--- a/src/mailman/database/tests/test_migrations.py
+++ b/src/mailman/database/tests/test_migrations.py
@@ -169,3 +169,30 @@ class TestMigrations(unittest.TestCase):
self.assertNotIn('type', results[i])
self.assertEqual(results[4]['type'], '"held message"')
self.assertEqual(results[5]['type'], '"registration"')
+
+ def test_70af5a4e5790_digests(self):
+ IDS_TO_DIGESTABLE = [
+ (1, True),
+ (2, False),
+ (3, False),
+ (4, True),
+ ]
+ mlist_table = sa.sql.table(
+ 'mailinglist',
+ sa.sql.column('id', sa.Integer),
+ sa.sql.column('digests_enabled', sa.Boolean)
+ )
+ # Downgrading.
+ for table_id, enabled in IDS_TO_DIGESTABLE:
+ config.db.store.execute(mlist_table.insert().values(
+ id=table_id, digests_enabled=enabled))
+ config.db.store.commit()
+ alembic.command.downgrade(alembic_cfg, '47294d3a604')
+ results = config.db.store.execute(
+ 'SELECT id, digestable FROM mailinglist').fetchall()
+ self.assertEqual(results, IDS_TO_DIGESTABLE)
+ # Upgrading.
+ alembic.command.upgrade(alembic_cfg, '70af5a4e5790')
+ results = config.db.store.execute(
+ 'SELECT id, digests_enabled FROM mailinglist').fetchall()
+ self.assertEqual(results, IDS_TO_DIGESTABLE)