Example #1
0
    def after_start_check(self):
        """Check if defined URL returns expected status to a HEAD request."""
        try:
            conn = HTTPConnection(self.host, self.port)

            conn.request('HEAD', self.url.path)
            status = str(conn.getresponse().status)

            if status == self.status or self.status_re.match(status):
                conn.close()
                return True

        except (HTTPException, socket.timeout, socket.error):
            return False
Example #2
0
    def after_start_check(self):
        """Check if defined url returns successful head."""
        try:
            conn = HTTPConnection(self.host, self.port)

            conn.request('HEAD', self.url.path)
            response = conn.getresponse()

            if response.status == OK:
                conn.close()
                return True

        except (HTTPException, socket.timeout, socket.error):
            return False
Example #3
0
    def after_start_check(self):
        """Check if defined url returns successful head."""
        try:
            conn = HTTPConnection(self.url.hostname, self.url.port)

            conn.request('HEAD', self.url.path)
            response = conn.getresponse()

            if response.status is OK:
                conn.close()
                return True

        except (HTTPException, socket.timeout, socket.error):
            return False
Example #4
0
    def after_start_check(self):
        """Check if defined URL returns expected status to a HEAD request."""
        try:
            conn = HTTPConnection(self.host, self.port)

            conn.request(self.method, self.url.path)
            status = str(conn.getresponse().status)

            if status == self.status or self.status_re.match(status):
                conn.close()
                return True

        except (HTTPException, socket.timeout, socket.error):
            return False
Example #5
0
def connect_to_server():
    """Common test to check if can connect to server."""
    conn = HTTPConnection(HOST, PORT)
    conn.request('GET', '/')
    assert conn.getresponse().status == OK
    conn.close()
Example #6
0
def connect_to_server():
    """Common test to check if can connect to server."""
    conn = HTTPConnection(HOST, PORT)
    conn.request('GET', '/')
    assert conn.getresponse().status == OK
    conn.close()
Example #7
0
def connect_to_server():
    """Connect to http server and assert 200 response."""
    conn = HTTPConnection(HOST, PORT)
    conn.request('GET', '/')
    assert conn.getresponse().status == OK
    conn.close()