diff options
| author | Barry Warsaw | 2012-09-04 22:25:49 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2012-09-04 22:25:49 -0400 |
| commit | 952cd3770fe4db4786efcc7c90d72dfa9aa74e68 (patch) | |
| tree | 17e850760dcb5e1a4a685d9ecc903550771df605 /src/mailman/database/tests | |
| parent | 5d42a53f1166ecaf98be69954894795c44a803a8 (diff) | |
| download | mailman-952cd3770fe4db4786efcc7c90d72dfa9aa74e68.tar.gz mailman-952cd3770fe4db4786efcc7c90d72dfa9aa74e68.tar.zst mailman-952cd3770fe4db4786efcc7c90d72dfa9aa74e68.zip | |
* Schema migrations (LP: #1024509)
- member.mailing_list -> list_id
Diffstat (limited to 'src/mailman/database/tests')
| -rw-r--r-- | src/mailman/database/tests/test_migrations.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py index 4ad709c16..8df50f40e 100644 --- a/src/mailman/database/tests/test_migrations.py +++ b/src/mailman/database/tests/test_migrations.py @@ -39,6 +39,7 @@ from mailman.interfaces.archiver import ArchivePolicy from mailman.interfaces.listmanager import IListManager from mailman.interfaces.mailinglist import IAcceptableAliasSet from mailman.interfaces.nntp import NewsgroupModeration +from mailman.interfaces.subscriptions import ISubscriptionService from mailman.testing.helpers import temporary_db from mailman.testing.layers import ConfigLayer @@ -59,6 +60,9 @@ class MigrationTestBase(unittest.TestCase): * REMOVE archive_private * REMOVE archive_volume_frequency * REMOVE nntp_host + + table member: + * mailing_list -> list_id """ layer = ConfigLayer @@ -90,6 +94,9 @@ class TestMigration20120407Schema(MigrationTestBase): self._database.store.execute, 'select {0} from mailinglist;'.format(missing)) self._database.store.rollback() + self.assertRaises(DatabaseError, + self._database.store.execute, + 'select list_id from member;') for present in ('archive', 'archive_private', 'archive_volume_frequency', @@ -102,6 +109,8 @@ class TestMigration20120407Schema(MigrationTestBase): # that we can perform? self._database.store.execute( 'select {0} from mailinglist;'.format(present)) + # Again, this should not produce an exception. + self._database.store.execute('select mailing_list from member;') def test_post_upgrade_columns_migration(self): # Test that after the migration, the old table columns are missing @@ -119,6 +128,7 @@ class TestMigration20120407Schema(MigrationTestBase): # that we can perform? self._database.store.execute( 'select {0} from mailinglist;'.format(present)) + self._database.store.execute('select list_id from member;') for missing in ('archive', 'archive_private', 'archive_volume_frequency', @@ -131,6 +141,9 @@ class TestMigration20120407Schema(MigrationTestBase): self._database.store.execute, 'select {0} from mailinglist;'.format(missing)) self._database.store.rollback() + self.assertRaises(DatabaseError, + self._database.store.execute, + 'select mailing_list from member;') @@ -273,6 +286,14 @@ class TestMigration20120407MigratedData(MigrationTestBase): mlist = getUtility(IListManager).get('test@example.com') self.assertEqual(mlist.list_id, 'test.example.com') + def test_list_id_member(self): + # Test that the member table's mailing_list column becomes list_id. + self._upgrade() + with temporary_db(self._database): + service = getUtility(ISubscriptionService) + members = list(service.find_members(list_id='test.example.com')) + self.assertEqual(len(members), 4) + def test_news_moderation_none(self): # Test that news_moderation becomes newsgroup_moderation. self._database.store.execute( |
