예제 #1
0
파일: test_http.py 프로젝트: heidtn/twisted
 def test_registerProducerTwiceFails(self):
     """
     Calling L{Request.registerProducer} when a producer is already
     registered raises ValueError.
     """
     req = http.Request(DummyChannel(), None)
     req.registerProducer(DummyProducer(), True)
     self.assertRaises(ValueError, req.registerProducer, DummyProducer(),
                       True)
예제 #2
0
파일: test_http.py 프로젝트: heidtn/twisted
 def test_registerProducerWhenQueuedPausesPushProducer(self):
     """
     Calling L{Request.registerProducer} with an IPushProducer when the
     request is queued pauses the producer.
     """
     req = http.Request(DummyChannel(), True)
     producer = DummyProducer()
     req.registerProducer(producer, True)
     self.assertEquals(['pause'], producer.events)
예제 #3
0
파일: test_http.py 프로젝트: heidtn/twisted
 def test_registerProducerWhenNotQueuedRegistersPullProducer(self):
     """
     Calling L{Request.registerProducer} with an IPullProducer when the
     request is not queued registers the producer as a pull producer on the
     request's transport.
     """
     req = http.Request(DummyChannel(), False)
     producer = DummyProducer()
     req.registerProducer(producer, False)
     self.assertEquals([(producer, False)], req.transport.producers)
예제 #4
0
파일: test_http.py 프로젝트: heidtn/twisted
 def test_registerProducerWhenQueuedDoesntPausePullProducer(self):
     """
     Calling L{Request.registerProducer} with an IPullProducer when the
     request is queued does not pause the producer, because it doesn't make
     sense to pause a pull producer.
     """
     req = http.Request(DummyChannel(), True)
     producer = DummyProducer()
     req.registerProducer(producer, False)
     self.assertEquals([], producer.events)
예제 #5
0
파일: test_http.py 프로젝트: heidtn/twisted
 def test_registerProducerWhenQueuedDoesntRegisterPullProducer(self):
     """
     Calling L{Request.registerProducer} with an IPullProducer when the
     request is queued does not register the producer on the request's
     transport.
     """
     self.assertIdentical(
         None, getattr(http.StringTransport, 'registerProducer', None),
         "StringTransport cannot implement registerProducer for this test "
         "to be valid.")
     req = http.Request(DummyChannel(), True)
     producer = DummyProducer()
     req.registerProducer(producer, False)
     # This is a roundabout assertion: http.StringTransport doesn't
     # implement registerProducer, so Request.registerProducer can't have
     # tried to call registerProducer on the transport.
     self.assertIsInstance(req.transport, http.StringTransport)