Skip to content

Commit

Permalink
Adding simple test cases to MIME functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
serpulga committed Aug 9, 2013
1 parent fae39b1 commit bccff84
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test.py
@@ -1,6 +1,6 @@
import os.path
import unittest
from postmark_inbound import PostmarkInbound
from postmark_inbound import PostmarkInbound, MIMEBase


class PostmarkInboundTest(unittest.TestCase):
Expand Down Expand Up @@ -92,6 +92,17 @@ def test_attachment_should_download(self):
assert True == os.path.exists('./tests/chart.png')
assert True == os.path.exists('./tests/chart2.png')

def test_attachment_to_mime(self):
for a in self.inbound.attachments():
mime = a.to_mime()
assert isinstance(mime, MIMEBase)
assert mime.get_filename() == a.name()
assert mime.get_content_type() == a.content_type()

def test_attachments_as_mime(self):
for a in self.inbound.attachments(as_mime=True):
assert isinstance(a, MIMEBase)

def test_send_date(self):
assert 2012 == self.inbound.send_date().year

Expand Down

0 comments on commit bccff84

Please sign in to comment.