(self)
| 1169 | |
| 1170 | # RemovedInDjango70Warning. |
| 1171 | def test_attach_mime_image_in_constructor(self): |
| 1172 | msg = ( |
| 1173 | "MIMEBase attachments are deprecated." |
| 1174 | " Use an email.message.MIMEPart instead." |
| 1175 | ) |
| 1176 | image = MIMEImage(b"\x89PNG...", "png") |
| 1177 | image["Content-Disposition"] = "attachment; filename=test.png" |
| 1178 | with self.assertWarnsMessage(RemovedInDjango70Warning, msg): |
| 1179 | email = EmailMessage(attachments=[image]) |
| 1180 | |
| 1181 | attachments = self.get_raw_attachments(email) |
| 1182 | self.assertEqual(len(attachments), 1) |
| 1183 | image_att = attachments[0] |
| 1184 | self.assertEqual(image_att.get_content_type(), "image/png") |
| 1185 | self.assertEqual(image_att.get_content(), b"\x89PNG...") |
| 1186 | self.assertEqual(image_att.get_filename(), "test.png") |
| 1187 | |
| 1188 | def test_attach_mime_part_in_constructor(self): |
| 1189 | image = MIMEPart() |
nothing calls this directly
no test coverage detected