Back to index

python3.2  3.2.2
Public Member Functions | Private Attributes
email.test.test_email.TestMIMEAudio Class Reference

List of all members.

Public Member Functions

def setUp
def test_guess_minor_type
def test_encoding
def test_checkSetMinor
def test_add_header

Private Attributes

 _audiodata
 _au

Detailed Description

Definition at line 1265 of file test_email.py.


Member Function Documentation

Definition at line 1266 of file test_email.py.

01266 
01267     def setUp(self):
01268         # Make sure we pick up the audiotest.au that lives in email/test/data.
01269         # In Python, there's an audiotest.au living in Lib/test but that isn't
01270         # included in some binary distros that don't include the test
01271         # package.  The trailing empty string on the .join() is significant
01272         # since findfile() will do a dirname().
01273         datadir = os.path.join(os.path.dirname(landmark), 'data', '')
01274         with open(findfile('audiotest.au', datadir), 'rb') as fp:
01275             self._audiodata = fp.read()
01276         self._au = MIMEAudio(self._audiodata)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1289 of file test_email.py.

01289 
01290     def test_add_header(self):
01291         eq = self.assertEqual
01292         unless = self.assertTrue
01293         self._au.add_header('Content-Disposition', 'attachment',
01294                             filename='audiotest.au')
01295         eq(self._au['content-disposition'],
01296            'attachment; filename="audiotest.au"')
01297         eq(self._au.get_params(header='content-disposition'),
01298            [('attachment', ''), ('filename', 'audiotest.au')])
01299         eq(self._au.get_param('filename', header='content-disposition'),
01300            'audiotest.au')
01301         missing = []
01302         eq(self._au.get_param('attachment', header='content-disposition'), '')
01303         unless(self._au.get_param('foo', failobj=missing,
01304                                   header='content-disposition') is missing)
01305         # Try some missing stuff
01306         unless(self._au.get_param('foobar', missing) is missing)
01307         unless(self._au.get_param('attachment', missing,
01308                                   header='foobar') is missing)
01309 
01310 
01311 
# Test the basic MIMEImage class

Here is the call graph for this function:

Definition at line 1285 of file test_email.py.

01285 
01286     def test_checkSetMinor(self):
01287         au = MIMEAudio(self._audiodata, 'fish')
01288         self.assertEqual(au.get_content_type(), 'audio/fish')

Here is the call graph for this function:

Definition at line 1280 of file test_email.py.

01280 
01281     def test_encoding(self):
01282         payload = self._au.get_payload()
01283         self.assertEqual(base64.decodebytes(bytes(payload, 'ascii')),
01284                 self._audiodata)

Here is the call graph for this function:

Definition at line 1277 of file test_email.py.

01277 
01278     def test_guess_minor_type(self):
01279         self.assertEqual(self._au.get_content_type(), 'audio/basic')

Here is the call graph for this function:


Member Data Documentation

Definition at line 1275 of file test_email.py.

Definition at line 1274 of file test_email.py.


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