Example #1
0
    def test_channel_request(self):
        """
        Test permissions when creating accounting
        """

        # Make channel request object
        channelRequest = HTTPLoggingChannelRequest(HTTPChannel())
        self.assertTrue(channelRequest != None)
Example #2
0
    def test_logging(self):
        """
        Test permissions when creating accounting
        """

        class FakeRequest(object):

            def handleContentChunk(self, data):
                pass
            def handleContentComplete(self):
                pass

        # Make log root a file
        channelRequest = HTTPLoggingChannelRequest(HTTPChannel(), queued=1)
        channelRequest.request = FakeRequest()

        channelRequest.gotInitialLine("GET / HTTP/1.1")
        channelRequest.lineReceived("Host:localhost")
        channelRequest.lineReceived("Content-Length:5")
        channelRequest.handleContentChunk("Bogus")
        channelRequest.handleContentComplete()
        channelRequest.writeHeaders(200, http_headers.Headers({"Content-Type": http_headers.MimeType('text', 'plain'), "Content-Length": "4"}))
        channelRequest.transport.write("Data")
        channelRequest.finish()