(self)
| 63 | eq(msg.get_all('xx', 'n/a'), 'n/a') |
| 64 | |
| 65 | def test_getset_charset(self): |
| 66 | eq = self.assertEqual |
| 67 | msg = Message() |
| 68 | eq(msg.get_charset(), None) |
| 69 | charset = Charset('iso-8859-1') |
| 70 | msg.set_charset(charset) |
| 71 | eq(msg['mime-version'], '1.0') |
| 72 | eq(msg.get_content_type(), 'text/plain') |
| 73 | eq(msg['content-type'], 'text/plain; charset="iso-8859-1"') |
| 74 | eq(msg.get_param('charset'), 'iso-8859-1') |
| 75 | eq(msg['content-transfer-encoding'], 'quoted-printable') |
| 76 | eq(msg.get_charset().input_charset, 'iso-8859-1') |
| 77 | # Remove the charset |
| 78 | msg.set_charset(None) |
| 79 | eq(msg.get_charset(), None) |
| 80 | eq(msg['content-type'], 'text/plain') |
| 81 | # Try adding a charset when there's already MIME headers present |
| 82 | msg = Message() |
| 83 | msg['MIME-Version'] = '2.0' |
| 84 | msg['Content-Type'] = 'text/x-weird' |
| 85 | msg['Content-Transfer-Encoding'] = 'quinted-puntable' |
| 86 | msg.set_charset(charset) |
| 87 | eq(msg['mime-version'], '2.0') |
| 88 | eq(msg['content-type'], 'text/x-weird; charset="iso-8859-1"') |
| 89 | eq(msg['content-transfer-encoding'], 'quinted-puntable') |
| 90 | |
| 91 | def test_set_charset_from_string(self): |
| 92 | eq = self.assertEqual |
nothing calls this directly
no test coverage detected