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