def rest_api(database_manager, full_access_user): api = create_rest_api(database_manager, None) api.test_client_class = RestAPITestClient with api.test_client(database_manager=database_manager, default_auth_user=full_access_user) as client: yield client
def _run(self): # get queue for sending events event_queue = self._event_manager.get_send_queue() # get WSGI app app = DispatcherMiddleware(app=create_app(event_queue), mounts={ '/docs': create_docs_server(event_queue), '/rest': create_rest_api(event_queue) }) # get gunicorn options options = SystemConfigReader().get_all_values_from_section('WebServer') # start gunicorn as own process webserver = HTTPServer(app, options) self.__webserver_proc = multiprocessing.Process(target=webserver.run) self.__webserver_proc.start() self.__webserver_proc.join()
def test_rest_api_start(self, database_manager, rest_api): api = create_rest_api(database_manager, None) assert isinstance(api, BaseCmdbApp) assert rest_api.get('/').get_json()['title'] == __title__