def get_status(env): name = env.booth.name return { "status": status.get_daemon_status(env.cmd_runner(), name), "ticket": status.get_tickets_status(env.cmd_runner(), name), "peers": status.get_peers_status(env.cmd_runner(), name), }
def test_failure(self): self.mock_run.run.return_value = ("out", "error", 1) assert_raise_library_error( lambda: lib.get_daemon_status(self.mock_run), (Severities.ERROR, report_codes.BOOTH_DAEMON_STATUS_ERROR, { "reason": "error\nout" })) self.mock_run.run.assert_called_once_with( [settings.booth_binary, "status"])
def test_failure(self): self.mock_run.run.return_value = ("out", "error", 1) assert_raise_library_error( lambda: lib.get_daemon_status(self.mock_run), ( Severities.ERROR, report_codes.BOOTH_DAEMON_STATUS_ERROR, {"reason": "error\nout"} ) ) self.mock_run.run.assert_called_once_with( [settings.booth_binary, "status"] )
def get_status(env: LibraryEnvironment, instance_name=None): """ get booth status info env string instance_name -- booth instance name """ booth_env = env.get_booth_env(instance_name) _ensure_live_env(env, booth_env) instance_name = booth_env.instance_name return { "status": status.get_daemon_status(env.cmd_runner(), instance_name), "ticket": status.get_tickets_status(env.cmd_runner(), instance_name), "peers": status.get_peers_status(env.cmd_runner(), instance_name), }
def test_daemon_not_running(self): self.mock_run.run.return_value = ("", "error", 7) self.assertEqual("", lib.get_daemon_status(self.mock_run)) self.mock_run.run.assert_called_once_with( [settings.booth_binary, "status"] )
def test_with_name(self): self.mock_run.run.return_value = ("output", "", 0) self.assertEqual("output", lib.get_daemon_status(self.mock_run, "name")) self.mock_run.run.assert_called_once_with( [settings.booth_binary, "status", "-c", "name"] )
def get_status(env, name=None): return { "status": status.get_daemon_status(env.cmd_runner(), name), "ticket": status.get_tickets_status(env.cmd_runner(), name), "peers": status.get_peers_status(env.cmd_runner(), name), }