mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-06 07:51:53 +00:00
fix(security): update tests for verdict and --force changes
This commit is contained in:
parent
0f8215f633
commit
789043b691
2 changed files with 11 additions and 11 deletions
|
|
@ -84,13 +84,13 @@ class TestDetermineVerdict:
|
|||
f = Finding("x", "high", "network", "f.py", 1, "m", "d")
|
||||
assert _determine_verdict([f]) == "caution"
|
||||
|
||||
def test_medium_finding_caution(self):
|
||||
def test_medium_finding_safe(self):
|
||||
f = Finding("x", "medium", "structural", "f.py", 1, "m", "d")
|
||||
assert _determine_verdict([f]) == "caution"
|
||||
assert _determine_verdict([f]) == "safe"
|
||||
|
||||
def test_low_finding_caution(self):
|
||||
def test_low_finding_safe(self):
|
||||
f = Finding("x", "low", "obfuscation", "f.py", 1, "m", "d")
|
||||
assert _determine_verdict([f]) == "caution"
|
||||
assert _determine_verdict([f]) == "safe"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
@ -145,21 +145,21 @@ class TestShouldAllowInstall:
|
|||
allowed, _ = should_allow_install(self._result("community", "dangerous", f), force=False)
|
||||
assert allowed is False
|
||||
|
||||
def test_force_overrides_dangerous_for_community(self):
|
||||
def test_force_does_not_override_dangerous_for_community(self):
|
||||
f = [Finding("x", "critical", "c", "f", 1, "m", "d")]
|
||||
allowed, reason = should_allow_install(
|
||||
self._result("community", "dangerous", f), force=True
|
||||
)
|
||||
assert allowed is True
|
||||
assert "Force-installed" in reason
|
||||
assert allowed is False
|
||||
assert "Blocked" in reason
|
||||
|
||||
def test_force_overrides_dangerous_for_trusted(self):
|
||||
def test_force_does_not_override_dangerous_for_trusted(self):
|
||||
f = [Finding("x", "critical", "c", "f", 1, "m", "d")]
|
||||
allowed, reason = should_allow_install(
|
||||
self._result("trusted", "dangerous", f), force=True
|
||||
)
|
||||
assert allowed is True
|
||||
assert "Force-installed" in reason
|
||||
assert allowed is False
|
||||
assert "Blocked" in reason
|
||||
|
||||
# -- agent-created policy --
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue