MCPcopy
hub / github.com/scrapy/scrapy / test_send_utf8

Method test_send_utf8

tests/test_mail.py:98–118  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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"

Callers

nothing calls this directly

Calls 3

sendMethod · 0.95
MailSenderClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected