Esempio n. 1
0
 def test_notifyModerator(self):
     """
     L{NewsShelf.notifyModerator} sends a moderation email to a single
     moderator.
     """
     shelf = NewsShelf('example.com', self.mktemp(), '*****@*****.**')
     shelf.sendmail = self.sendmail
     shelf.notifyModerator('*****@*****.**', Article('Foo: bar', 'Some text'))
     self.assertEquals(len(self._email), 1)
Esempio n. 2
0
 def test_notifyModerator(self):
     """
     L{NewsShelf.notifyModerator} sends a moderation email to a single
     moderator.
     """
     shelf = NewsShelf('example.com', self.mktemp(), '*****@*****.**')
     shelf.sendmail = self.sendmail
     shelf.notifyModerator('*****@*****.**', Article('Foo: bar', 'Some text'))
     self.assertEqual(len(self._email), 1)
Esempio n. 3
0
 def test_notifyModerator(self):
     """
     L{NewsShelf.notifyModerator} sends a moderation email to a single
     moderator.
     """
     shelf = NewsShelf("example.com", self.mktemp(), "*****@*****.**")
     shelf.sendmail = self.sendmail
     shelf.notifyModerator("*****@*****.**", Article("Foo: bar", "Some text"))
     self.assertEqual(len(self._email), 1)
Esempio n. 4
0
 def test_defaultSender(self):
     """
     If no sender is specified to L{NewsShelf.notifyModerators}, a default
     address based on the system hostname is used for both the envelope and
     RFC 2822 sender addresses.
     """
     shelf = NewsShelf('example.com', self.mktemp())
     shelf.sendmail = self.sendmail
     shelf.notifyModerators(['*****@*****.**'], Article('Foo: bar', 'Some text'))
     self.assertEqual(self._email[0][1], 'twisted-news@' + gethostname())
     self.assertIn('From: twisted-news@' + gethostname(), self._email[0][3])
Esempio n. 5
0
 def test_defaultSender(self):
     """
     If no sender is specified to L{NewsShelf.notifyModerators}, a default
     address based on the system hostname is used for both the envelope and
     RFC 2822 sender addresses.
     """
     shelf = NewsShelf('example.com', self.mktemp())
     shelf.sendmail = self.sendmail
     shelf.notifyModerators(['*****@*****.**'], Article('Foo: bar', 'Some text'))
     self.assertEquals(self._email[0][1], 'twisted-news@' + gethostname())
     self.assertIn('From: twisted-news@' + gethostname(), self._email[0][3])
Esempio n. 6
0
 def test_defaultSender(self):
     """
     If no sender is specified to L{NewsShelf.notifyModerators}, a default
     address based on the system hostname is used for both the envelope and
     RFC 2822 sender addresses.
     """
     shelf = NewsShelf("example.com", self.mktemp())
     shelf.sendmail = self.sendmail
     shelf.notifyModerators(["*****@*****.**"], Article("Foo: bar", "Some text"))
     self.assertEqual(self._email[0][1], "twisted-news@" + gethostname())
     self.assertIn("From: twisted-news@" + gethostname(), self._email[0][3])
Esempio n. 7
0
 def getStorage(self, groups, moderators, mailhost, sender):
     """
     Create and return a L{NewsShelf} instance configured to require
     moderation.
     """
     storageFilename = self.mktemp()
     shelf = NewsShelf(mailhost, storageFilename, sender)
     for name in groups:
         shelf.addGroup(name, 'm') # Dial 'm' for moderator
         for address in moderators.get(name, []):
             shelf.addModerator(name, address)
     shelf.sendmail = self.sendmail
     return shelf
Esempio n. 8
0
 def getStorage(self, groups, moderators, mailhost, sender):
     """
     Create and return a L{NewsShelf} instance configured to require
     moderation.
     """
     storageFilename = self.mktemp()
     shelf = NewsShelf(mailhost, storageFilename, sender)
     for name in groups:
         shelf.addGroup(name, 'm') # Dial 'm' for moderator
         for address in moderators.get(name, []):
             shelf.addModerator(name, address)
     shelf.sendmail = self.sendmail
     return shelf