'Though there should be no way for the internal C{finishedConsuming}
L{Deferred} in L{Request._writeToBodyProducerContentLength} to fire a
L{Failure} after the C{finishedProducing} L{Deferred} has fired, in
case this does happen, the error should be logged with a message about
how there\'s probably a bug in L{Request}.
This is a whitebox test.'

def test_sendRequestBodyErrorWithConsumerError(self):

    producer = StringProducer(3)
    request = Request('POST', '/bar', _boringHeaders, producer)
    request.writeTo(self.transport)
    finishedConsuming = producer.consumer._finished
    producer.consumer.write('abc')
    producer.finished.callback(None)
    finishedConsuming.errback(ArbitraryException())
    self.assertEqual(len(self.flushLoggedErrors(ArbitraryException)), 1)
