Exemplo n.º 1
0
    def runTest(self):
        """Attempts to parse the contents of get_request and
        get_response."""
        p = RequestMessage()
        for t in get_request:
            text = p.feed(t)
            self.assertEqual(text, '')

        self.assertTrue(p.headers_complete())
        self.assertTrue(p.complete())

        self.assertEqual(get_request, p.get_decoded_message())

        p = ResponseMessage(p)
        for char in get_response:
            text = p.feed(char)
            self.assertEqual(text, '')

        self.assertTrue(p.headers_complete())
        self.assertTrue(p.complete())
        self.assertEqual(get_response, p.get_decoded_message())
        self.assertEqual("tests", p.get_body())
Exemplo n.º 2
0
    def runTest(self):
        """Attempts to parse the contents of get_request and
        get_response."""
        p = RequestMessage()
        for t in get_request:
            if isinstance(t, int): t = bytes([t])  # python3
            text = p.feed(t)
            self.assertEqual(text, b'')

        self.assertTrue(p.headers_complete())
        self.assertTrue(p.complete())

        self.assertEqual(get_request, p.get_decoded_message())

        p = ResponseMessage(p)
        for char in get_response:
            if isinstance(char, int): char = bytes([char])  # python3
            text = p.feed(char)
            self.assertEqual(text, b'')

        self.assertTrue(p.headers_complete())
        self.assertTrue(p.complete())
        self.assertEqual(get_response, p.get_decoded_message())
        self.assertEqual(b"tests", p.get_body())
Exemplo n.º 3
0
    def runTest(self):
        """Attempts to parse the contents of get_request and
        get_response."""
        p = RequestMessage()
        for t in get_request:
            if isinstance(t, int): t = bytes([t]) # python3
            text = p.feed(t)
            self.assertEqual(text, b'')

        self.assertTrue(p.headers_complete())
        self.assertTrue(p.complete())

        self.assertEqual(get_request, p.get_decoded_message())

        p = ResponseMessage(p)
        for char in get_response:
            if isinstance(char, int): char = bytes([char]) # python3
            text = p.feed(char)
            self.assertEqual(text, b'')

        self.assertTrue(p.headers_complete())
        self.assertTrue(p.complete())
        self.assertEqual(get_response, p.get_decoded_message())
        self.assertEqual(b"tests", p.get_body())