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
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
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
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
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()
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()