'If a L{Request} object has registered itself as a producer with a
L{HTTPChannel} object, and the L{HTTPChannel} object is paused, both
the transport and L{Request} objects get paused.'

def test_HTTPChannelPropagatesPausedProductionToRequest(self):

    (channel, transport) = self.buildChannelAndTransport(StringTransport(), DelayedHTTPHandler)
    channel._optimisticEagerReadSize = 0
    channel.dataReceived(self.request)
    channel.dataReceived('123')
    request = channel.requests[0].original
    producer = DummyProducer()
    request.registerProducer(producer, True)
    self.assertEqual(transport.producerState, 'paused')
    self.assertEqual(producer.events, [])
    channel.pauseProducing()
    self.assertEqual(transport.producerState, 'paused')
    self.assertEqual(producer.events, ['pause'])
    channel.resumeProducing()
    self.assertEqual(transport.producerState, 'paused')
    self.assertEqual(producer.events, ['pause', 'resume'])
    request.unregisterProducer()
    request.delayedProcess()
    self.assertEqual(transport.producerState, 'producing')
