def start_api_server(self, remote_host=None, ssl_verification=None, listen_address=None, listen_port=None, ssl_cert=None, ssl_key=None): """Starts the API server as a separate process.""" self.api_server_process = Process(target=self.execute_api_server, args=(listen_address, listen_port, ssl_cert, ssl_key)) self.api_server_process.start() if remote_host is None: remote_host = saq.API_PREFIX if ssl_verification is None: ssl_verification = saq.CONFIG['SSL']['ca_chain_path'] import ace_api result = None errors = [] for x in range(5): try: result = ace_api.ping(remote_host=remote_host, ssl_verification=ssl_verification) break except Exception as e: errors.append(str(e)) time.sleep(1) if result is None: for error in errors: logging.error(error) self.fail("unable to start api server")
def test_ping(self): result = ace_api.ping() self.assertIsNotNone(result) self.assertTrue('result' in result) self.assertEquals(result['result'], 'pong')