MCPcopy Index your code
hub / github.com/python/cpython / test_add_header

Method test_add_header

Lib/test/test_email/test_email.py:1698–1716  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1696 self.assertEqual(im.get_content_type(), 'image/fish')
1697
1698 def test_add_header(self):
1699 self._make_image('gif')
1700 eq = self.assertEqual
1701 self._im.add_header('Content-Disposition', 'attachment',
1702 filename='dingusfish.gif')
1703 eq(self._im['content-disposition'],
1704 'attachment; filename="dingusfish.gif"')
1705 eq(self._im.get_params(header='content-disposition'),
1706 [('attachment', ''), ('filename', 'dingusfish.gif')])
1707 eq(self._im.get_param('filename', header='content-disposition'),
1708 'dingusfish.gif')
1709 missing = []
1710 eq(self._im.get_param('attachment', header='content-disposition'), '')
1711 self.assertIs(self._im.get_param('foo', failobj=missing,
1712 header='content-disposition'), missing)
1713 # Try some missing stuff
1714 self.assertIs(self._im.get_param('foobar', missing), missing)
1715 self.assertIs(self._im.get_param('attachment', missing,
1716 header='foobar'), missing)
1717
1718
1719# Test the basic MIMEApplication class

Callers

nothing calls this directly

Calls 6

_make_imageMethod · 0.95
eqFunction · 0.85
get_paramsMethod · 0.80
get_paramMethod · 0.80
add_headerMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected