def test_only_2_alternatives_allowed(self): e1 = Envelope().message("He<b>llo</b>").message("Hello", alternative="plain") # we can replace alternative e1.copy().message("Test").message("Test", alternative="plain") # but in the moment we set all three and call send or preview, we should fail self.assertRaises( ValueError, e1.copy().message("Test", alternative="html").preview)
def test_contents_fetching(self): t = "Small sample text attachment.\n" with open("tests/eml/generic.txt") as f: e1 = Envelope(f) e2 = e1.copy() # stays intact even if copied to another instance self.assertEqual(e1.message(), t) self.assertEqual(e2.message(), t) self.assertEqual(e2.copy().message(), t)