(self)
| 498 | self.assertEqual(s.getvalue(), expected) |
| 499 | |
| 500 | def test_smtp_policy(self): |
| 501 | msg = EmailMessage() |
| 502 | msg["From"] = Address(addr_spec="foo@bar.com", display_name="Páolo") |
| 503 | msg["To"] = Address(addr_spec="bar@foo.com", display_name="Dinsdale") |
| 504 | msg["Subject"] = "Nudge nudge, wink, wink" |
| 505 | msg.set_content("oh boy, know what I mean, know what I mean?") |
| 506 | expected = textwrap.dedent("""\ |
| 507 | From: =?utf-8?q?P=C3=A1olo?= <foo@bar.com> |
| 508 | To: Dinsdale <bar@foo.com> |
| 509 | Subject: Nudge nudge, wink, wink |
| 510 | Content-Type: text/plain; charset="utf-8" |
| 511 | Content-Transfer-Encoding: 7bit |
| 512 | MIME-Version: 1.0 |
| 513 | |
| 514 | oh boy, know what I mean, know what I mean? |
| 515 | """).encode().replace(b"\n", b"\r\n") |
| 516 | s = io.BytesIO() |
| 517 | g = BytesGenerator(s, policy=policy.SMTP) |
| 518 | g.flatten(msg) |
| 519 | self.assertEqual(s.getvalue(), expected) |
| 520 | |
| 521 | |
| 522 | if __name__ == '__main__': |
nothing calls this directly
no test coverage detected