Ejemplo n.º 1
0
    def testResponseNotFound(self):

        expectBody = '{"request":"/","response":"not-found"}'
        conn = HttpConnection()
        response = conn.send("GET / HTTP/1.1")
        conn.close()

        self.assertTrue(expectBody in response)
Ejemplo n.º 2
0
    def testRequestForSystem(self):

        expectBody = '{"request":"/SYSTEM","response":{"version":"0.0.1.1"}}'

        conn = HttpConnection()
        response = conn.send("GET /SYSTEM HTTP/1.1")
        conn.close()

        self.assertTrue(expectBody in response)
Ejemplo n.º 3
0
    def testFirefoxRequest(self):

        for i in range(300):
            now = time.time()
            conn = HttpConnection()
            response = conn.send(Firefox.request)
            conn.close()
            self.assertLess((time.time() - now), 0.005)
            self.assertTrue(Firefox.expectBody in response)
Ejemplo n.º 4
0
    def testCharacterEncodingSpecified(self):

        expectField = 'Content-Type: application/json; charset=utf-8'

        conn = HttpConnection()
        response = conn.send("GET / HTTP/1.1")
        conn.close()

        self.assertTrue(expectField.lower() in response.lower())
Ejemplo n.º 5
0
    def testChromeRequest(self):

        for i in range(300):
            now = time.time()
            conn = HttpConnection()
            response = conn.send(Chrome.request)
            conn.close()
            #
            # Each request should takes less than 5 thousandths of
            # of a second. This isn't a functional requirement, it's
            # just to flag up code changes that impact performance.
            #
            self.assertLess((time.time() - now), 0.005)
            self.assertTrue(Chrome.expectBody in response)