'If the full body of the L{IResponse} passed to L{client.readBody} is
not definitely received, the L{Deferred} returned by L{client.readBody}
fires with a L{Failure} wrapping L{client.PartialDownloadError} with
the content that was received.'

def test_withPotentialDataLoss(self):

    response = DummyResponse()
    d = client.readBody(response)
    response.protocol.dataReceived('first')
    response.protocol.dataReceived('second')
    response.protocol.connectionLost(Failure(PotentialDataLoss()))
    failure = self.failureResultOf(d)
    failure.trap(client.PartialDownloadError)
    self.assertEqual({'status': failure.value.status, 'message': failure.value.message, 'body': failure.value.response}, {'status': '200', 'message': 'OK', 'body': 'firstsecond'})
