def test_serve_daemon(self): port = network_util.get_free_port() pid_file = os.path.join(self._home, "test.pid") extra_args = ["--daemon", "--pid_file", pid_file] serve = functools.partial(self._run, port, extra_args) self._launch_thread_and_wait(serve, port) admin_gi = api.gi(port) user_api_key = api.user_api_key(admin_gi) user_gi = api.gi(port, user_api_key) assert len(user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 0 user_gi.histories.create_history(TEST_HISTORY_NAME)
def test_serve_daemon(self): port = network_util.get_free_port() pid_file = os.path.join(self._home, "test.pid") extra_args = ["--daemon", "--pid_file", pid_file] serve = functools.partial(self._run, port, extra_args) self._launch_thread_and_wait(serve, port) admin_gi = api.gi(port) user_api_key = api.user_api_key(admin_gi) user_gi = api.gi(port, user_api_key) assert len( user_gi.histories.get_histories(name=TEST_HISTORY_NAME)) == 0 user_gi.histories.create_history(TEST_HISTORY_NAME)
def _user_gi(self): admin_gi = api.gi(self._port) user_api_key = api.user_api_key(admin_gi) user_gi = api.gi(self._port, key=user_api_key) return user_gi