def test_message_object(self): from repoze.postoffice.api import _send_mail as fut smtp = DummySMTPLib() message = DummyMessage("Hello") fut("me", ["you", "them"], message, smtplib=smtp) self.assertEqual(smtp.sent, [("me", ["you", "them"], message.as_string())])
def test_it(self): message = "From: me\n" "To: you\n" " and your mom\n" "Subject: Hello\n" "\n" "Hi mate.\n" "\n" from cStringIO import StringIO fp = StringIO(message) from repoze.postoffice.api import _read_message_headers as fut expected = dict(From="me", To="you and your mom", Subject="Hello") self.assertEqual(fut(fp), expected)
def _call_fut(self, dummy_config): from repoze.postoffice.api import _get_opt_float as fut return fut(dummy_config, None, None, None)
def test_string_message(self): from repoze.postoffice.api import _send_mail as fut smtp = DummySMTPLib() fut("me", ["you", "them"], "Hello", smtplib=smtp) self.assertEqual(smtp.sent, [("me", ["you", "them"], "Hello")])