Пример #1
0
 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)
Пример #2
0
 def test_migration_mailing_lists(self):
     # Test that the mailing lists survive migration.
     with temporary_db(self._database):
         # There should be exactly one mailing list defined.
         mlists = list(getUtility(IListManager).mailing_lists)
         self.assertEqual(len(mlists), 1)
         self.assertEqual(mlists[0].fqdn_listname, '*****@*****.**')
Пример #3
0
 def test_migration_acceptable_aliases(self):
     # Test that the mailing list's acceptable aliases survive migration.
     # This proves that foreign key references are migrated properly.
     with temporary_db(self._database):
         mlist = getUtility(IListManager).get('*****@*****.**')
         aliases_set = IAcceptableAliasSet(mlist)
         self.assertEqual(set(aliases_set.aliases),
                          set(['*****@*****.**', '*****@*****.**']))
Пример #4
0
 def test_migration_domains(self):
     # Test that the domains table, which isn't touched, doesn't change.
     with temporary_db(self._database):
         # Check that the domains survived the migration.  This table
         # was not touched so it should be fine.
         domains = list(getUtility(IDomainManager))
         self.assertEqual(len(domains), 1)
         self.assertEqual(domains[0].mail_host, 'example.com')
Пример #5
0
 def test_allow_list_posts_true(self):
     # Test that include_list_post_header -> allow_list_posts.
     self._database.store.execute(
         'UPDATE mailinglist SET include_list_post_header = {0} '
         'WHERE id = 1;'.format(self._database.TRUE))
     self._upgrade()
     with temporary_db(self._database):
         mlist = getUtility(IListManager).get('*****@*****.**')
         self.assertTrue(mlist.allow_list_posts)
Пример #6
0
 def test_nntp_prefix_subject_too_true(self):
     # Test that news_prefix_subject_too becomes nntp_prefix_subject_too.
     self._database.store.execute(
         'UPDATE mailinglist SET news_prefix_subject_too = {0} '
         'WHERE id = 1;'.format(self._database.TRUE))
     self._upgrade()
     with temporary_db(self._database):
         mlist = getUtility(IListManager).get('*****@*****.**')
         self.assertTrue(mlist.nntp_prefix_subject_too)
Пример #7
0
 def test_news_moderation_moderated(self):
     # Test that news_moderation becomes newsgroup_moderation.
     self._database.store.execute(
         'UPDATE mailinglist SET news_moderation = 2 '
         'WHERE id = 1;')
     self._upgrade()
     with temporary_db(self._database):
         mlist = getUtility(IListManager).get('*****@*****.**')
         self.assertEqual(mlist.newsgroup_moderation,
                          NewsgroupModeration.moderated)
Пример #8
0
 def test_archive_policy_private(self):
     # Test that the new archive_policy value is updated correctly for
     # private archives.
     self._database.store.execute(
         'UPDATE mailinglist SET archive = {0}, archive_private = {0} '
         'WHERE id = 1;'.format(self._database.TRUE))
     # Complete the migration
     self._upgrade()
     with temporary_db(self._database):
         mlist = getUtility(IListManager).get('*****@*****.**')
         self.assertEqual(mlist.archive_policy, ArchivePolicy.private)
Пример #9
0
 def test_migration_archive_policy_never_0(self):
     # Test that the new archive_policy value is updated correctly.  In the
     # case of old column archive=0, the archive_private column is
     # ignored.  This test sets it to 0 to ensure it's ignored.
     self._database.store.execute(
         'UPDATE mailinglist SET archive = {0}, archive_private = {0} '
         'WHERE id = 1;'.format(self._database.FALSE))
     # Complete the migration
     self._upgrade()
     with temporary_db(self._database):
         mlist = getUtility(IListManager).get('*****@*****.**')
         self.assertEqual(mlist.archive_policy, ArchivePolicy.never)
Пример #10
0
 def test_migration_members(self):
     # Test that the members of a mailing list all survive migration.
     with temporary_db(self._database):
         mlist = getUtility(IListManager).get('*****@*****.**')
         # Test that all the members we expect are still there.  Start with
         # the two list delivery members.
         addresses = set(address.email
                         for address in mlist.members.addresses)
         self.assertEqual(addresses,
                          set(['*****@*****.**', '*****@*****.**']))
         # There is one owner.
         owners = set(address.email for address in mlist.owners.addresses)
         self.assertEqual(len(owners), 1)
         self.assertEqual(owners.pop(), '*****@*****.**')
         # There is one moderator.
         moderators = set(address.email
                          for address in mlist.moderators.addresses)
         self.assertEqual(len(moderators), 1)
         self.assertEqual(moderators.pop(), '*****@*****.**')
Пример #11
0
 def test_list_id(self):
     # Test that the mailinglist table gets a list_id column.
     self._upgrade()
     with temporary_db(self._database):
         mlist = getUtility(IListManager).get('*****@*****.**')
         self.assertEqual(mlist.list_id, 'test.example.com')