MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_add_header

Method test_add_header

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

Source from the content-addressed store, hash-verified

1674 self.assertEqual(im.get_content_type(), 'image/fish')
1675
1676 def test_add_header(self):
1677 self._make_image('gif')
1678 eq = self.assertEqual
1679 self._im.add_header('Content-Disposition', 'attachment',
1680 filename='dingusfish.gif')
1681 eq(self._im['content-disposition'],
1682 'attachment; filename="dingusfish.gif"')
1683 eq(self._im.get_params(header='content-disposition'),
1684 [('attachment', ''), ('filename', 'dingusfish.gif')])
1685 eq(self._im.get_param('filename', header='content-disposition'),
1686 'dingusfish.gif')
1687 missing = []
1688 eq(self._im.get_param('attachment', header='content-disposition'), '')
1689 self.assertIs(self._im.get_param('foo', failobj=missing,
1690 header='content-disposition'), missing)
1691 # Try some missing stuff
1692 self.assertIs(self._im.get_param('foobar', missing), missing)
1693 self.assertIs(self._im.get_param('attachment', missing,
1694 header='foobar'), missing)
1695
1696
1697# Test the basic MIMEApplication class

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected