def test_with_attachments(self): for email in (attach_email, attach_email2): email = open(attach_email).read() payload = base64.standard_b64encode(email) parser = CommEmailParser(payload) body = parser.get_body() ok_('Body inspection' in body) eq_(parser.get_uuid(), 'abc123')
def test_quoted_printable(self): email = open(quopri_email).read() payload = base64.standard_b64encode(email) parser = CommEmailParser(payload) body = parser.get_body() ok_('Yo,\n\nas it is open source' in body) ok_('=20' not in body) ok_('*****@*****.**' not in body)
class TestEmailParser(TestCase): def setUp(self): email_text = open(sample_email).read() self.parser = CommEmailParser(email_text) def test_uuid(self): eq_(self.parser.get_uuid(), '5a0b8a83d501412589cc5d562334b46b') def test_body(self): eq_(self.parser.get_body(), 'test note 5\n') def test_multipart(self): multipart_email = open(multi_email).read() payload = base64.standard_b64encode(multipart_email) parser = CommEmailParser(payload) eq_(parser.get_body(), 'this is the body text\n') eq_(parser.get_uuid(), 'abc123')
def test_multipart(self): email = open(multi_email).read() payload = base64.standard_b64encode(email) parser = CommEmailParser(payload) eq_(parser.get_body(), 'this is the body text\n') eq_(parser.get_uuid(), 'abc123')
def test_basic_email(self): email_text = open(sample_email).read() parser = CommEmailParser(email_text) eq_(parser.get_uuid(), '5a0b8a83d501412589cc5d562334b46b') eq_(parser.get_body(), 'test note 5\n')
def setUp(self): email_text = open(sample_email).read() self.parser = CommEmailParser(email_text)