Пример #1
0
 def test_invalid_status(self):
     transport = StringTransport()
     factory = CrawlmiHTPPClientFactory(Request(url='http://foo/bar'))
     protocol = CrawlmiHTTPClient()
     protocol.factory = factory
     protocol.makeConnection(transport)
     protocol.headers = Headers()
     protocol.dataReceived('HTTP/1.0 BUG OK\r\n')
     protocol.dataReceived('Hello: World\r\n')
     protocol.dataReceived('Foo: Bar\r\n')
     protocol.dataReceived('\r\n')
     protocol.handleResponse('')
     return self.assertFailure(factory.deferred, BadHttpHeaderError)
Пример #2
0
 def test_invalid_status(self):
     transport = StringTransport()
     factory = CrawlmiHTPPClientFactory(Request(url='http://foo/bar'))
     protocol = CrawlmiHTTPClient()
     protocol.factory = factory
     protocol.makeConnection(transport)
     protocol.headers = Headers()
     protocol.dataReceived('HTTP/1.0 BUG OK\r\n')
     protocol.dataReceived('Hello: World\r\n')
     protocol.dataReceived('Foo: Bar\r\n')
     protocol.dataReceived('\r\n')
     protocol.handleResponse('')
     return self.assertFailure(factory.deferred, BadHttpHeaderError)