Ejemplo n.º 1
0
    def test_msg_contains_body_and_attachment(self):
        e = Email('*****@*****.**', '*****@*****.**', 'subject', 'fubar')
        e.attachments.append(Attachment('./tests/440Hz-5sec.mp3'))

        # body will be base64 encoded:
        self.assertTrue('ZnViYXI=' in str(e)[:500])
        self.assertTrue('filename="440Hz' in str(e)[:800])
Ejemplo n.º 2
0
    def test_msg_contains_html_body_and_attachment(self):
        e = Email('*****@*****.**', '*****@*****.**', 'subject')
        e.body = '<html><body><b>fubar</b></body></html>'
        e.body_is_html = True
        e.attachments.append(Attachment('./tests/440Hz-5sec.mp3'))

        # body will be base64 encoded:
        self.assertTrue('PGh0bWw+PGJvZHk+PGI+ZnViYXI8L2I+PC9ib2R5PjwvaHRtbD4='
                        in str(e)[:500])
        self.assertTrue('filename="440Hz' in str(e)[:800])
Ejemplo n.º 3
0
 def test_filename_in_header(self):
     a = Attachment('./tests/440Hz-5sec.mp3')
     msg = str(a.as_msg())
     self.assertTrue('attachment; filename="440Hz-5sec.mp3' in msg[:200])
Ejemplo n.º 4
0
 def test_audio(self):
     a = Attachment('./tests/440Hz-5sec.mp3')
     self.assertTrue('audio/mpeg' in str(a.as_msg()))
     self.assertIsInstance(a.as_msg(), MIMEAudio)
Ejemplo n.º 5
0
 def test_images(self):
     a = Attachment('./tests/test.png')
     self.assertTrue('image/png' in str(a.as_msg()))
     self.assertIsInstance(a.as_msg(), MIMEImage)
Ejemplo n.º 6
0
 def test_filename_in_header(self):
     a = Attachment('./tests/440Hz-5sec.mp3')
     msg = str(a.as_msg())
     self.assertTrue('attachment; filename="440Hz-5sec.mp3' in msg[:200])
Ejemplo n.º 7
0
 def test_audio(self):
     a = Attachment('./tests/440Hz-5sec.mp3')
     self.assertTrue('audio/mpeg' in str(a.as_msg()))
     self.assertIsInstance(a.as_msg(), MIMEAudio)
Ejemplo n.º 8
0
 def test_images(self):
     a = Attachment('./tests/test.png')
     self.assertTrue('image/png' in str(a.as_msg()))
     self.assertIsInstance(a.as_msg(), MIMEImage)