Lines Matching full:content
28 m['Content-Type'] = 'text/plain'
43 m['Content-Type'] = 'text/plain'
51 m['Content-Type'] = 'text/plain'
116 m['Content-Type'] = 'multipart/foo'
122 m['Content-Foo'] = 'bar'
123 m['Content-Type'] = 'text/html'
129 self.assertIsNone(m['Content-Foo'])
130 self.assertIsNone(m['Content-Type'])
150 Content-Type: text/plain
158 Content-Type: text/html
167 Content-Type: text/plain; charset=latin1
175 Content-Type: text/plain; charset="latin-1"
176 Content-Transfer-Encoding: quoted-printable
184 Content-Type: text/plain; charset="utf8"
185 Content-Transfer-Encoding: base64
193 Content-Type: text/plain; charset="utf8"
194 Content-Transfer-Encoding: quoted-printable
202 Content-Type: text/plain; charset="utf8"
203 Content-Transfer-Encoding: quoted-printable
212 Content-Type: text/plain; charset="utf8"
213 Content-Transfer-Encoding: base64
222 Content-Type: text/plain
231 Content-Type: {}
232 Content-Transfer-Encoding: base64
243 Content-Type: image/jpg
244 Content-Transfer-Encoding: base64
253 Content-Type: multipart/mixed; boundary="==="
263 Content-Type: message/{}
283 Content-Type: message/partial
295 content = "Simple message.\n"
296 raw_data_manager.set_content(m, content)
298 Content-Type: text/plain; charset="utf-8"
299 Content-Transfer-Encoding: 7bit
303 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
304 self.assertEqual(m.get_content(), content)
308 content = ''
309 raw_data_manager.set_content(m, content)
311 Content-Type: text/plain; charset="utf-8"
312 Content-Transfer-Encoding: 7bit
321 content = "<p>Simple message.</p>\n"
322 raw_data_manager.set_content(m, content, subtype='html')
324 Content-Type: text/html; charset="utf-8"
325 Content-Transfer-Encoding: 7bit
329 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
330 self.assertEqual(m.get_content(), content)
334 content = "Simple message.\n"
335 raw_data_manager.set_content(m, content, charset='latin-1')
337 Content-Type: text/plain; charset="iso-8859-1"
338 Content-Transfer-Encoding: 7bit
342 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
343 self.assertEqual(m.get_content(), content)
347 content = ("Simple but long message that is over 78 characters"
349 raw_data_manager.set_content(m, content)
351 Content-Type: text/plain; charset="utf-8"
352 Content-Transfer-Encoding: quoted-printable
357 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
358 self.assertEqual(m.get_content(), content)
362 content = "et là il est monté sur moi et il commence à m'éto.\n"
363 raw_data_manager.set_content(m, content)
365 Content-Type: text/plain; charset="utf-8"
366 Content-Transfer-Encoding: 8bit
370 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
371 self.assertEqual(m.get_content(), content)
375 content = ("j'ai un problème de python. il est sorti de son"
378 raw_data_manager.set_content(m, content)
380 Content-Type: text/plain; charset="utf-8"
381 Content-Transfer-Encoding: quoted-printable
387 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
388 self.assertEqual(m.get_content(), content)
392 content = '\n'*10 + (
396 raw_data_manager.set_content(m, content)
398 Content-Type: text/plain; charset="utf-8"
399 Content-Transfer-Encoding: quoted-printable
405 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
406 self.assertEqual(m.get_content(), content)
410 content = "áàäéèęöő.\n"
411 raw_data_manager.set_content(m, content)
413 Content-Type: text/plain; charset="utf-8"
414 Content-Transfer-Encoding: 8bit
418 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
419 self.assertEqual(m.get_content(), content)
423 content = '\n'*10 + "áàäéèęöő.\n"
424 raw_data_manager.set_content(m, content)
426 Content-Type: text/plain; charset="utf-8"
427 Content-Transfer-Encoding: 8bit
431 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
432 self.assertEqual(m.get_content(), content)
436 content = ("áàäéèęöőáàäéèęöőáàäéèęöőáàäéèęöő"
439 raw_data_manager.set_content(m, content)
441 Content-Type: text/plain; charset="utf-8"
442 Content-Transfer-Encoding: base64
450 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
451 self.assertEqual(m.get_content(), content)
457 content = ('\n'*10 +
466 Content-Type: text/plain; charset="utf-8"
467 Content-Transfer-Encoding: quoted-printable
481 self.assertEqual(m.get_payload(decode=True).decode('utf-8'), content)
482 self.assertEqual(m.get_content(), content)
502 content = self._make_message()
503 content['To'] = 'python@vivarium.org'
504 content['From'] = 'police@monty.org'
505 content['Subject'] = "get back in your box"
506 content.set_content("Or face the comfy chair.")
507 raw_data_manager.set_content(m, content)
510 Content-Type: message/rfc822
511 Content-Transfer-Encoding: 8bit
516 Content-Type: text/plain; charset="utf-8"
517 Content-Transfer-Encoding: 7bit
524 self.assertEqual(str(payload), str(content))
526 self.assertEqual(str(m.get_content()), str(content))
531 content = self._make_message()
532 content['To'] = 'police@monty.org'
533 content['From'] = 'victim@monty.org'
534 content['Subject'] = "Help"
535 content.set_content("j'ai un problème de python. il est sorti de son"
537 raw_data_manager.set_content(m, content)
540 Content-Type: message/rfc822
541 Content-Transfer-Encoding: 8bit
546 Content-Type: text/plain; charset="utf-8"
547 Content-Transfer-Encoding: 8bit
560 Content-Type: message/rfc822
561 Content-Transfer-Encoding: 8bit
566 Content-Type: text/plain; charset="utf-8"
567 Content-Transfer-Encoding: base64
574 self.assertEqual(str(m.get_content()), str(content))
578 content = self._make_message()
583 m.set_content(content, subtype, cte=cte)
591 m.set_content(content, subtype, cte=cte)
597 for content in (b"bogus content",
598 bytearray(b"bogus content"),
599 memoryview(b"bogus content")):
600 with self.subTest(content=content):
602 raw_data_manager.set_content(m, content, 'image', 'jpeg')
604 Content-Type: image/jpeg
605 Content-Transfer-Encoding: base64
609 self.assertEqual(m.get_payload(decode=True), content)
610 self.assertEqual(m.get_content(), content)
622 content = b'b\xFFgus\tcon\nt\rent ' + b'z'*100
623 m.set_content(content, 'audio', 'aif', cte='quoted-printable')
625 Content-Type: audio/aif
626 Content-Transfer-Encoding: quoted-printable
631 self.assertEqual(m.get_payload(decode=True), content)
632 self.assertEqual(m.get_content(), content)
636 content = b'b\xFFgus\tcon\nt\rent ' + b'z'*100
637 m.set_content(content, 'video', 'mpeg', cte='binary')
639 Content-Type: video/mpeg
640 Content-Transfer-Encoding: binary
648 self.assertEqual(m.get_payload(decode=True), content)
649 self.assertEqual(m.get_content(), content)
655 content = b'b\xFFgus\tcon\nt\rent\n' + b'z'*60 + b'\n'
656 m.set_content(content, 'application', 'octet-stream', cte='8bit')
658 Content-Type: application/octet-stream
659 Content-Transfer-Encoding: 8bit
665 self.assertEqual(m.get_payload(decode=True), content)
666 self.assertEqual(m.get_content(), content)
670 content = "Simple message.\n"
672 raw_data_manager.set_content(m, content, headers=(
677 Content-Type: text/plain; charset="utf-8"
681 Content-Transfer-Encoding: 7bit
688 content = "Simple message.\n"
689 raw_data_manager.set_content(m, content, headers=(
693 Content-Type: text/plain; charset="utf-8"
696 Content-Transfer-Encoding: 7bit
703 content = "Simple message.\n"
704 with self.assertRaisesRegex(ValueError, 'Content-Type'):
705 raw_data_manager.set_content(m, content, headers=(
706 "Content-Type: foo/bar",)
711 content = "Simple message.\n"
713 with self.assertRaisesRegex(ValueError, 'Content-Type'):
714 raw_data_manager.set_content(m, content, headers=(
715 header_factory("Content-Type", " foo/bar"),)
720 content = "Simple message.\n"
722 raw_data_manager.set_content(m, content, headers=(
729 content = "Simple message.\n"
732 raw_data_manager.set_content(m, content, headers=(
740 self.assertEqual(m['Content-Disposition'], 'inline')
745 self.assertEqual(m['Content-Disposition'], 'attachment')
750 self.assertEqual(m['Content-Disposition'], 'foo')
758 self.assertEqual(m['Content-Disposition'],
764 self.assertEqual(m['Content-Disposition'], 'inline; filename="bar.txt"')
770 Content-Type: text/plain; charset="utf-8"
771 Content-Transfer-Encoding: 7bit
772 Content-Disposition: attachment;
784 Content-Type: application/octet-stream
785 Content-Transfer-Encoding: 7bit
792 'text_plain': ('content', ()),
793 'text_html': ('content', ('html',)),
794 'application_octet_stream': (b'content',
796 'image_jpeg': (b'content', ('image', 'jpeg')),
812 self.assertEqual(m['Content-Disposition'], 'inline')
817 self.assertEqual(m['Content-Disposition'], 'inline; filename="bár.txt"')
819 self.assertEqual(m['Content-Disposition'].params['filename'], "bár.txt")
824 self.assertEqual(m['Content-ID'], 'some_random_stuff')
832 self.assertEqual(m['Content-Type'].params, params)