'If passed an incomplete multipart message, MultiPartParser does not
attempt to read beyond the end of the stream, and simply will handle
the part that can be parsed gracefully.'

def test_truncated_multipart_handled_gracefully(self):

    payload_str = u'\r\n'.join([(u'--' + client.BOUNDARY), u'Content-Disposition:    form-data;    name="file";    filename="foo.txt"', u'Content-Type:    application/octet-stream', u'', ((u'file    contents--' + client.BOUNDARY) + u'--'), u''])
    payload = client.FakePayload(payload_str[:(-10)])
    r = {u'CONTENT_LENGTH': len(payload), u'CONTENT_TYPE': client.MULTIPART_CONTENT, u'PATH_INFO': u'/file_uploads/echo/', u'REQUEST_METHOD': u'POST', u'wsgi.input': payload}
    got = json.loads(self.client.request(**r).content.decode(u'utf-8'))
    self.assertEqual(got, {})
