(self)
| 160 | self._test_base64_upload("Big data" * 68000, encode=base64.encodebytes) |
| 161 | |
| 162 | def test_base64_invalid_upload(self): |
| 163 | payload = client.FakePayload( |
| 164 | "\r\n".join( |
| 165 | [ |
| 166 | "--" + client.BOUNDARY, |
| 167 | 'Content-Disposition: form-data; name="file"; filename="test.txt"', |
| 168 | "Content-Type: application/octet-stream", |
| 169 | "Content-Transfer-Encoding: base64", |
| 170 | "", |
| 171 | ] |
| 172 | ) |
| 173 | ) |
| 174 | payload.write(b"\r\n!\r\n") |
| 175 | payload.write("--" + client.BOUNDARY + "--\r\n") |
| 176 | request = WSGIRequest( |
| 177 | { |
| 178 | "CONTENT_LENGTH": len(payload), |
| 179 | "CONTENT_TYPE": client.MULTIPART_CONTENT, |
| 180 | "PATH_INFO": "/echo_content/", |
| 181 | "REQUEST_METHOD": "POST", |
| 182 | "wsgi.input": payload, |
| 183 | } |
| 184 | ) |
| 185 | msg = "Could not decode base64 data." |
| 186 | with self.assertRaisesMessage(MultiPartParserError, msg): |
| 187 | request.POST |
| 188 | |
| 189 | def test_unicode_file_name(self): |
| 190 | with sys_tempfile.TemporaryDirectory() as temp_dir: |
nothing calls this directly
no test coverage detected