Back to index

python3.2  3.2.2
Public Member Functions | Private Attributes
email.test.test_email.TestMIMEImage 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

 _imgdata
 _im

Detailed Description

Definition at line 1312 of file test_email.py.


Member Function Documentation

Definition at line 1313 of file test_email.py.

01313 
01314     def setUp(self):
01315         with openfile('PyBanner048.gif', 'rb') as fp:
01316             self._imgdata = fp.read()
01317         self._im = MIMEImage(self._imgdata)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1330 of file test_email.py.

01330 
01331     def test_add_header(self):
01332         eq = self.assertEqual
01333         unless = self.assertTrue
01334         self._im.add_header('Content-Disposition', 'attachment',
01335                             filename='dingusfish.gif')
01336         eq(self._im['content-disposition'],
01337            'attachment; filename="dingusfish.gif"')
01338         eq(self._im.get_params(header='content-disposition'),
01339            [('attachment', ''), ('filename', 'dingusfish.gif')])
01340         eq(self._im.get_param('filename', header='content-disposition'),
01341            'dingusfish.gif')
01342         missing = []
01343         eq(self._im.get_param('attachment', header='content-disposition'), '')
01344         unless(self._im.get_param('foo', failobj=missing,
01345                                   header='content-disposition') is missing)
01346         # Try some missing stuff
01347         unless(self._im.get_param('foobar', missing) is missing)
01348         unless(self._im.get_param('attachment', missing,
01349                                   header='foobar') is missing)
01350 
01351 
01352 
# Test the basic MIMEApplication class

Here is the call graph for this function:

Definition at line 1326 of file test_email.py.

01326 
01327     def test_checkSetMinor(self):
01328         im = MIMEImage(self._imgdata, 'fish')
01329         self.assertEqual(im.get_content_type(), 'image/fish')

Here is the call graph for this function:

Definition at line 1321 of file test_email.py.

01321 
01322     def test_encoding(self):
01323         payload = self._im.get_payload()
01324         self.assertEqual(base64.decodebytes(bytes(payload, 'ascii')),
01325                 self._imgdata)

Here is the call graph for this function:

Definition at line 1318 of file test_email.py.

01318 
01319     def test_guess_minor_type(self):
01320         self.assertEqual(self._im.get_content_type(), 'image/gif')

Here is the call graph for this function:


Member Data Documentation

Definition at line 1316 of file test_email.py.

Definition at line 1315 of file test_email.py.


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