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

Method test_set_boundary

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

Source from the content-addressed store, hash-verified

182 eq(msg.get_boundary(), 'BOUNDARY')
183
184 def test_set_boundary(self):
185 eq = self.assertEqual
186 # This one has no existing boundary parameter, but the Content-Type:
187 # header appears fifth.
188 msg = self._msgobj('msg_01.txt')
189 msg.set_boundary('BOUNDARY')
190 header, value = msg.items()[4]
191 eq(header.lower(), 'content-type')
192 eq(value, 'text/plain; charset="us-ascii"; boundary="BOUNDARY"')
193 # This one has a Content-Type: header, with a boundary, stuck in the
194 # middle of its headers. Make sure the order is preserved; it should
195 # be fifth.
196 msg = self._msgobj('msg_04.txt')
197 msg.set_boundary('BOUNDARY')
198 header, value = msg.items()[4]
199 eq(header.lower(), 'content-type')
200 eq(value, 'multipart/mixed; boundary="BOUNDARY"')
201 # And this one has no Content-Type: header at all.
202 msg = self._msgobj('msg_03.txt')
203 self.assertRaises(errors.HeaderParseError,
204 msg.set_boundary, 'BOUNDARY')
205
206 def test_make_boundary(self):
207 msg = MIMEMultipart('form-data')

Callers

nothing calls this directly

Calls 6

set_boundaryMethod · 0.80
eqFunction · 0.50
_msgobjMethod · 0.45
itemsMethod · 0.45
lowerMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected