(self)
| 96 | assert attach.get_payload(decode=True) == b"content" |
| 97 | |
| 98 | def test_send_utf8(self): |
| 99 | subject = "sübjèçt" |
| 100 | body = "bödÿ-àéïöñß" |
| 101 | mailsender = MailSender(debug=True) |
| 102 | mailsender.send( |
| 103 | to=["test@scrapy.org"], |
| 104 | subject=subject, |
| 105 | body=body, |
| 106 | charset="utf-8", |
| 107 | _callback=self._catch_mail_sent, |
| 108 | ) |
| 109 | |
| 110 | assert self.catched_msg |
| 111 | assert self.catched_msg["subject"] == subject |
| 112 | assert self.catched_msg["body"] == body |
| 113 | |
| 114 | msg = self.catched_msg["msg"] |
| 115 | assert msg["subject"] == subject |
| 116 | assert msg.get_payload(decode=True).decode("utf-8") == body |
| 117 | assert msg.get_charset() == Charset("utf-8") |
| 118 | assert msg.get("Content-Type") == 'text/plain; charset="utf-8"' |
| 119 | |
| 120 | def test_send_attach_utf8(self): |
| 121 | subject = "sübjèçt" |
nothing calls this directly
no test coverage detected