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)
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])