'If it is called with a total number of bytes exceeding the indicated
limit passed to L{LengthEnforcingConsumer.__init__},
L{LengthEnforcingConsumer.write} fires the L{Deferred} with a
L{Failure} wrapping a L{WrongBodyLength} and also calls the
C{stopProducing} method of the producer.'

def test_writeTooMany(self, _unregisterAfter=False):

    self.enforcer.write(('x' * 10))
    self.assertFalse(self.producer.stopped)
    self.enforcer.write('x')
    self.assertTrue(self.producer.stopped)
    if _unregisterAfter:
        self.enforcer._noMoreWritesExpected()
    return self.assertFailure(self.result, WrongBodyLength)
