Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes | Private Member Functions
email.test.test_email.TestIdempotent Class Reference
Inheritance diagram for email.test.test_email.TestIdempotent:
Inheritance graph
[legend]
Collaboration diagram for email.test.test_email.TestIdempotent:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_parse_text_message
def test_parse_untyped_message
def test_simple_multipart
def test_MIME_digest
def test_long_header
def test_MIME_digest_with_part_headers
def test_mixed_with_image
def test_multipart_report
def test_dsn
def test_preamble_epilogue
def test_multipart_one_part
def test_multipart_no_parts
def test_no_start_boundary
def test_rfc2231_charset
def test_more_rfc2231_parameters
def test_text_plain_in_a_multipart_digest
def test_nested_multipart_mixeds
def test_message_external_body_idempotent
def test_message_delivery_status
def test_message_signed_idempotent
def test_content_type
def test_parser
def ndiffAssertEqual

Static Public Attributes

string linesep = '\n'

Private Member Functions

def _msgobj
def _idempotent

Detailed Description

Definition at line 2285 of file test_email.py.


Member Function Documentation

def email.test.test_email.TestIdempotent._idempotent (   self,
  msg,
  text,
  unixfrom = False 
) [private]

Definition at line 2295 of file test_email.py.

02295 
02296     def _idempotent(self, msg, text, unixfrom=False):
02297         eq = self.ndiffAssertEqual
02298         s = StringIO()
02299         g = Generator(s, maxheaderlen=0)
02300         g.flatten(msg, unixfrom=unixfrom)
02301         eq(text, s.getvalue())

Here is the call graph for this function:

Here is the caller graph for this function:

def email.test.test_email.TestIdempotent._msgobj (   self,
  filename 
) [private]

Reimplemented from email.test.test_email.TestEmailBase.

Definition at line 2289 of file test_email.py.

02289 
02290     def _msgobj(self, filename):
02291         with openfile(filename) as fp:
02292             data = fp.read()
02293         msg = email.message_from_string(data)
02294         return msg, data

Here is the call graph for this function:

def email.test.test_email.TestEmailBase.ndiffAssertEqual (   self,
  first,
  second 
) [inherited]
Like assertEqual except use ndiff for readable output.

Definition at line 57 of file test_email.py.

00057 
00058     def ndiffAssertEqual(self, first, second):
00059         """Like assertEqual except use ndiff for readable output."""
00060         if first != second:
00061             sfirst = str(first)
00062             ssecond = str(second)
00063             rfirst = [repr(line) for line in sfirst.splitlines()]
00064             rsecond = [repr(line) for line in ssecond.splitlines()]
00065             diff = difflib.ndiff(rfirst, rsecond)
00066             raise self.failureException(NL + NL.join(diff))

Here is the call graph for this function:

Definition at line 2394 of file test_email.py.

02394 
02395     def test_content_type(self):
02396         eq = self.assertEqual
02397         unless = self.assertTrue
02398         # Get a message object and reset the seek pointer for other tests
02399         msg, text = self._msgobj('msg_05.txt')
02400         eq(msg.get_content_type(), 'multipart/report')
02401         # Test the Content-Type: parameters
02402         params = {}
02403         for pk, pv in msg.get_params():
02404             params[pk] = pv
02405         eq(params['report-type'], 'delivery-status')
02406         eq(params['boundary'], 'D1690A7AC1.996856090/mail.example.com')
02407         eq(msg.preamble, 'This is a MIME-encapsulated message.' + self.linesep)
02408         eq(msg.epilogue, self.linesep)
02409         eq(len(msg.get_payload()), 3)
02410         # Make sure the subparts are what we expect
02411         msg1 = msg.get_payload(0)
02412         eq(msg1.get_content_type(), 'text/plain')
02413         eq(msg1.get_payload(), 'Yadda yadda yadda' + self.linesep)
02414         msg2 = msg.get_payload(1)
02415         eq(msg2.get_content_type(), 'text/plain')
02416         eq(msg2.get_payload(), 'Yadda yadda yadda' + self.linesep)
02417         msg3 = msg.get_payload(2)
02418         eq(msg3.get_content_type(), 'message/rfc822')
02419         self.assertTrue(isinstance(msg3, Message))
02420         payload = msg3.get_payload()
02421         unless(isinstance(payload, list))
02422         eq(len(payload), 1)
02423         msg4 = payload[0]
02424         unless(isinstance(msg4, Message))
02425         eq(msg4.get_payload(), 'Yadda yadda yadda' + self.linesep)

Here is the call graph for this function:

Definition at line 2346 of file test_email.py.

02346 
02347     def test_dsn(self):
02348         msg, text = self._msgobj('msg_16.txt')
02349         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2330 of file test_email.py.

02330 
02331     def test_long_header(self):
02332         msg, text = self._msgobj('msg_27.txt')
02333         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2386 of file test_email.py.

02386 
02387     def test_message_delivery_status(self):
02388         msg, text = self._msgobj('msg_43.txt')
02389         self._idempotent(msg, text, unixfrom=True)

Here is the call graph for this function:

Definition at line 2382 of file test_email.py.

02382 
02383     def test_message_external_body_idempotent(self):
02384         msg, text = self._msgobj('msg_36.txt')
02385         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2390 of file test_email.py.

02390 
02391     def test_message_signed_idempotent(self):
02392         msg, text = self._msgobj('msg_45.txt')
02393         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2326 of file test_email.py.

02326 
02327     def test_MIME_digest(self):
02328         msg, text = self._msgobj('msg_02.txt')
02329         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2334 of file test_email.py.

02334 
02335     def test_MIME_digest_with_part_headers(self):
02336         msg, text = self._msgobj('msg_28.txt')
02337         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2338 of file test_email.py.

02338 
02339     def test_mixed_with_image(self):
02340         msg, text = self._msgobj('msg_06.txt')
02341         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2370 of file test_email.py.

02370 
02371     def test_more_rfc2231_parameters(self):
02372         msg, text = self._msgobj('msg_33.txt')
02373         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2358 of file test_email.py.

02358 
02359     def test_multipart_no_parts(self):
02360         msg, text = self._msgobj('msg_24.txt')
02361         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2354 of file test_email.py.

02354 
02355     def test_multipart_one_part(self):
02356         msg, text = self._msgobj('msg_23.txt')
02357         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2342 of file test_email.py.

02342 
02343     def test_multipart_report(self):
02344         msg, text = self._msgobj('msg_05.txt')
02345         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2378 of file test_email.py.

02378 
02379     def test_nested_multipart_mixeds(self):
02380         msg, text = self._msgobj('msg_12a.txt')
02381         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2362 of file test_email.py.

02362 
02363     def test_no_start_boundary(self):
02364         msg, text = self._msgobj('msg_31.txt')
02365         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2302 of file test_email.py.

02302 
02303     def test_parse_text_message(self):
02304         eq = self.assertEqual
02305         msg, text = self._msgobj('msg_01.txt')
02306         eq(msg.get_content_type(), 'text/plain')
02307         eq(msg.get_content_maintype(), 'text')
02308         eq(msg.get_content_subtype(), 'plain')
02309         eq(msg.get_params()[1], ('charset', 'us-ascii'))
02310         eq(msg.get_param('charset'), 'us-ascii')
02311         eq(msg.preamble, None)
02312         eq(msg.epilogue, None)
02313         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2314 of file test_email.py.

02314 
02315     def test_parse_untyped_message(self):
02316         eq = self.assertEqual
02317         msg, text = self._msgobj('msg_03.txt')
02318         eq(msg.get_content_type(), 'text/plain')
02319         eq(msg.get_params(), None)
02320         eq(msg.get_param('charset'), None)
02321         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2426 of file test_email.py.

02426 
02427     def test_parser(self):
02428         eq = self.assertEqual
02429         unless = self.assertTrue
02430         msg, text = self._msgobj('msg_06.txt')
02431         # Check some of the outer headers
02432         eq(msg.get_content_type(), 'message/rfc822')
02433         # Make sure the payload is a list of exactly one sub-Message, and that
02434         # that submessage has a type of text/plain
02435         payload = msg.get_payload()
02436         unless(isinstance(payload, list))
02437         eq(len(payload), 1)
02438         msg1 = payload[0]
02439         self.assertTrue(isinstance(msg1, Message))
02440         eq(msg1.get_content_type(), 'text/plain')
02441         self.assertTrue(isinstance(msg1.get_payload(), str))
02442         eq(msg1.get_payload(), self.linesep)
02443 
02444 
02445 
# Test various other bits of the package's functionality

Here is the call graph for this function:

Definition at line 2350 of file test_email.py.

02350 
02351     def test_preamble_epilogue(self):
02352         msg, text = self._msgobj('msg_21.txt')
02353         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2366 of file test_email.py.

02366 
02367     def test_rfc2231_charset(self):
02368         msg, text = self._msgobj('msg_32.txt')
02369         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2322 of file test_email.py.

02322 
02323     def test_simple_multipart(self):
02324         msg, text = self._msgobj('msg_04.txt')
02325         self._idempotent(msg, text)

Here is the call graph for this function:

Definition at line 2374 of file test_email.py.

02374 
02375     def test_text_plain_in_a_multipart_digest(self):
02376         msg, text = self._msgobj('msg_34.txt')
02377         self._idempotent(msg, text)

Here is the call graph for this function:


Member Data Documentation


The documentation for this class was generated from the following file: