Test open_dashboard early-return when web start fails
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
4545b2b5a2
commit
a57cf4a16f
1 changed files with 13 additions and 0 deletions
|
|
@ -71,6 +71,19 @@ class TestActions(unittest.TestCase):
|
||||||
self.assertEqual(len(runner.calls), 1)
|
self.assertEqual(len(runner.calls), 1)
|
||||||
self.assertEqual(opened, ["https://127.0.0.1:8787/"])
|
self.assertEqual(opened, ["https://127.0.0.1:8787/"])
|
||||||
|
|
||||||
|
def test_open_dashboard_returns_early_when_start_fails(self):
|
||||||
|
# is-active -> inactive, then start -> failure
|
||||||
|
runner = _Recorder([_proc(out="inactive"),
|
||||||
|
_proc(rc=1, err="Access denied")])
|
||||||
|
opened = []
|
||||||
|
res = actions.open_dashboard(Config(), runner, opener=opened.append)
|
||||||
|
self.assertFalse(res.ok)
|
||||||
|
self.assertEqual(runner.calls[0],
|
||||||
|
["systemctl", "is-active", "enodia-sentinel-web.service"])
|
||||||
|
self.assertEqual(runner.calls[1],
|
||||||
|
["systemctl", "start", "enodia-sentinel-web.service"])
|
||||||
|
self.assertEqual(opened, [])
|
||||||
|
|
||||||
def test_run_check_counts_findings(self):
|
def test_run_check_counts_findings(self):
|
||||||
runner = _Recorder([_proc(out=json.dumps([{"signature": "rsh"},
|
runner = _Recorder([_proc(out=json.dumps([{"signature": "rsh"},
|
||||||
{"signature": "suid"}]))])
|
{"signature": "suid"}]))])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue