Пример #1
0
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),
    }
Пример #2
0
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),
    }
Пример #3
0
 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"])
Пример #4
0
 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"]
     )
Пример #5
0
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),
    }
Пример #6
0
 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"]
     )
Пример #7
0
 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"]
     )
Пример #8
0
 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"]
     )
Пример #9
0
 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"]
     )
Пример #10
0
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),
    }
Пример #11
0
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),
    }