Back to index

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

List of all members.

Public Member Functions

def test_initialize_with_unixfrom
def test_from
def test_flags
def setUp
def tearDown
def test_initialize_with_eMM
def test_initialize_with_string
def test_initialize_with_file
def test_initialize_with_binary_file
def test_initialize_with_nothing
def test_initialize_incorrectly
def test_become_message
def test_explain_to

Private Member Functions

def _post_initialize_hook
def _check_from

Static Private Attributes

 _factory = mailbox._mboxMMDFMessage

Detailed Description

Definition at line 1396 of file test_mailbox.py.


Member Function Documentation

def test.test_mailbox._TestMboxMMDFMessage._check_from (   self,
  msg,
  sender = None 
) [private]

Definition at line 1435 of file test_mailbox.py.

01435 
01436     def _check_from(self, msg, sender=None):
01437         # Check contents of "From " line
01438         if sender is None:
01439             sender = "MAILER-DAEMON"
01440         self.assertTrue(re.match(sender + r" \w{3} \w{3} [\d ]\d [\d ]\d:\d{2}:"
01441                               r"\d{2} \d{4}", msg.get_from()) is not None)
01442 

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from test.test_mailbox.TestMessage.

Definition at line 1400 of file test_mailbox.py.

01400 
01401     def _post_initialize_hook(self, msg):
01402         self._check_from(msg)

Here is the call graph for this function:

def test.test_mailbox.TestMessage.setUp (   self) [inherited]

Definition at line 1246 of file test_mailbox.py.

01246 
01247     def setUp(self):
01248         self._path = support.TESTFN

Here is the caller graph for this function:

def test.test_mailbox.TestMessage.tearDown (   self) [inherited]

Definition at line 1249 of file test_mailbox.py.

01249 
01250     def tearDown(self):
01251         self._delete_recursively(self._path)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1298 of file test_mailbox.py.

01298 
01299     def test_become_message(self):
01300         # Take on the state of another message
01301         eMM = email.message_from_string(_sample_message)
01302         msg = self._factory()
01303         msg._become_message(eMM)
01304         self._check_sample(msg)

Here is the call graph for this function:

Definition at line 1305 of file test_mailbox.py.

01305 
01306     def test_explain_to(self):
01307         # Copy self's format-specific data to other message formats.
01308         # This test is superficial; better ones are in TestMessageConversion.
01309         msg = self._factory()
01310         for class_ in (mailbox.Message, mailbox.MaildirMessage,
01311                        mailbox.mboxMessage, mailbox.MHMessage,
01312                        mailbox.BabylMessage, mailbox.MMDFMessage):
01313             other_msg = class_()
01314             msg._explain_to(other_msg)
01315         other_msg = email.message.Message()
01316         self.assertRaises(TypeError, lambda: msg._explain_to(other_msg))

Here is the call graph for this function:

Definition at line 1421 of file test_mailbox.py.

01421 
01422     def test_flags(self):
01423         # Use get_flags(), set_flags(), add_flag(), remove_flag()
01424         msg = mailbox.mboxMessage(_sample_message)
01425         self.assertEqual(msg.get_flags(), '')
01426         msg.set_flags('F')
01427         self.assertEqual(msg.get_flags(), 'F')
01428         msg.set_flags('XODR')
01429         self.assertEqual(msg.get_flags(), 'RODX')
01430         msg.add_flag('FA')
01431         self.assertEqual(msg.get_flags(), 'RODFAX')
01432         msg.remove_flag('FDXA')
01433         self.assertEqual(msg.get_flags(), 'RO')
01434         self._check_sample(msg)

Here is the call graph for this function:

Definition at line 1410 of file test_mailbox.py.

01410 
01411     def test_from(self):
01412         # Get and set "From " line
01413         msg = mailbox.mboxMessage(_sample_message)
01414         self._check_from(msg)
01415         msg.set_from('foo bar')
01416         self.assertEqual(msg.get_from(), 'foo bar')
01417         msg.set_from('foo@bar', True)
01418         self._check_from(msg, 'foo@bar')
01419         msg.set_from('blah@temp', time.localtime())
01420         self._check_from(msg, 'blah@temp')

Here is the call graph for this function:

Definition at line 1294 of file test_mailbox.py.

01294 
01295     def test_initialize_incorrectly(self):
01296         # Initialize with invalid argument
01297         self.assertRaises(TypeError, lambda: self._factory(object()))

Here is the call graph for this function:

Definition at line 1274 of file test_mailbox.py.

01274 
01275     def test_initialize_with_binary_file(self):
01276         # Initialize based on contents of binary file
01277         with open(self._path, 'wb+') as f:
01278             f.write(_bytes_sample_message)
01279             f.seek(0)
01280             msg = self._factory(f)
01281             self._post_initialize_hook(msg)
01282             self._check_sample(msg)

Here is the call graph for this function:

Definition at line 1252 of file test_mailbox.py.

01252 
01253     def test_initialize_with_eMM(self):
01254         # Initialize based on email.message.Message instance
01255         eMM = email.message_from_string(_sample_message)
01256         msg = self._factory(eMM)
01257         self._post_initialize_hook(msg)
01258         self._check_sample(msg)

Here is the call graph for this function:

Definition at line 1265 of file test_mailbox.py.

01265 
01266     def test_initialize_with_file(self):
01267         # Initialize based on contents of file
01268         with open(self._path, 'w+') as f:
01269             f.write(_sample_message)
01270             f.seek(0)
01271             msg = self._factory(f)
01272             self._post_initialize_hook(msg)
01273             self._check_sample(msg)

Here is the call graph for this function:

Definition at line 1283 of file test_mailbox.py.

01283 
01284     def test_initialize_with_nothing(self):
01285         # Initialize without arguments
01286         msg = self._factory()
01287         self._post_initialize_hook(msg)
01288         self.assertIsInstance(msg, email.message.Message)
01289         self.assertIsInstance(msg, mailbox.Message)
01290         self.assertIsInstance(msg, self._factory)
01291         self.assertEqual(msg.keys(), [])
01292         self.assertFalse(msg.is_multipart())
01293         self.assertEqual(msg.get_payload(), None)

Here is the call graph for this function:

Definition at line 1259 of file test_mailbox.py.

01259 
01260     def test_initialize_with_string(self):
01261         # Initialize based on string
01262         msg = self._factory(_sample_message)
01263         self._post_initialize_hook(msg)
01264         self._check_sample(msg)

Here is the call graph for this function:

Definition at line 1403 of file test_mailbox.py.

01403 
01404     def test_initialize_with_unixfrom(self):
01405         # Initialize with a message that already has a _unixfrom attribute
01406         msg = mailbox.Message(_sample_message)
01407         msg.set_unixfrom('From foo@bar blah')
01408         msg = mailbox.mboxMessage(msg)
01409         self.assertEqual(msg.get_from(), 'foo@bar blah', msg.get_from())

Here is the call graph for this function:


Member Data Documentation

Reimplemented from test.test_mailbox.TestMessage.

Reimplemented in test.test_mailbox.TestMMDFMessage, and test.test_mailbox.TestMboxMessage.

Definition at line 1398 of file test_mailbox.py.


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