def test_foregroundDelivery(self): """ The I{-odf} flags specifies foreground delivery. """ stdin = StringIO("\n") self.patch(sys, "stdin", stdin) o = parseOptions("-odf") self.assertFalse(o.background)
def test_backgroundDelivery(self): """ The I{-odb} flag specifies background delivery. """ stdin = StringIO("\n") self.patch(sys, "stdin", stdin) o = parseOptions("-odb") self.assertTrue(o.background)
def test_overrideFromFlagByFromHeader(self): """ The I{-F} flag specifies the From: value. However, I{-F} flag is overriden by the value of From: in the e-mail header. """ stdin = StringIO("To: Curly <*****@*****.**>\n" "From: Shemp <*****@*****.**>\n") self.patch(sys, "stdin", stdin) o = parseOptions(["-F", "Groucho <*****@*****.**>", "-t"]) self.assertEqual(o.sender, "*****@*****.**")
def test_setFrom(self): """ When a message has no I{From:} header, a I{From:} value can be specified with the I{-F} flag. """ stdin = StringIO("To: [email protected]\n" "Subject: A wise guy?\n\n") self.patch(sys, "stdin", stdin) o = parseOptions(["-F", "Larry <*****@*****.**>", "-t"]) self.assertEqual(o.sender, "Larry <*****@*****.**>")
def test_recipientsFromHeaders(self): """ The I{-t} flags specifies that recipients should be obtained from headers. """ stdin = StringIO("To: Curly <*****@*****.**>\n" "Cc: Larry <*****@*****.**>\n" "Bcc: Moe <*****@*****.**>\n" "\n" "Oh, a wise guy?\n") self.patch(sys, "stdin", stdin) o = parseOptions("-t") self.assertEqual(len(o.to), 3)