mirror of
https://github.com/MayersScott/rkn-block-checker.git
synced 2026-08-27 03:44:40 +00:00
tests: summary thresholds
This commit is contained in:
parent
0b5b25b06f
commit
42dcf7c9eb
1 changed files with 40 additions and 0 deletions
40
tests/test_summary.py
Normal file
40
tests/test_summary.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
from rkn_checker.output import _summary_verdict
|
||||
|
||||
|
||||
class TestSummaryVerdict:
|
||||
def test_degraded_connection_when_whitelist_mostly_fails(self):
|
||||
_, msg = _summary_verdict(
|
||||
white_ok=5, white_total=20, black_ok=0, black_blocked=15, black_total=15
|
||||
)
|
||||
assert "degraded" in msg.lower()
|
||||
|
||||
def test_no_blocks_when_blacklist_fully_open(self):
|
||||
_, msg = _summary_verdict(
|
||||
white_ok=20, white_total=20, black_ok=15, black_blocked=0, black_total=15
|
||||
)
|
||||
assert "not in" in msg.lower()
|
||||
|
||||
def test_blocked_zone_when_majority_of_blacklist_fails(self):
|
||||
_, msg = _summary_verdict(
|
||||
white_ok=20, white_total=20, black_ok=3, black_blocked=12, black_total=15
|
||||
)
|
||||
assert "are in" in msg.lower()
|
||||
|
||||
def test_partial_blocks_when_some_blacklist_loads(self):
|
||||
_, msg = _summary_verdict(
|
||||
white_ok=20, white_total=20, black_ok=10, black_blocked=5, black_total=15
|
||||
)
|
||||
assert "partial" in msg.lower()
|
||||
|
||||
def test_partial_blocks_at_threshold_boundary(self):
|
||||
# 11/15 = ~73% — should already be over the 70% threshold.
|
||||
_, msg = _summary_verdict(
|
||||
white_ok=20, white_total=20, black_ok=3, black_blocked=11, black_total=15
|
||||
)
|
||||
assert "are in" in msg.lower()
|
||||
|
||||
def test_whitelist_check_takes_priority(self):
|
||||
_, msg = _summary_verdict(
|
||||
white_ok=2, white_total=20, black_ok=0, black_blocked=15, black_total=15
|
||||
)
|
||||
assert "degraded" in msg.lower()
|
||||
Loading…
Add table
Add a link
Reference in a new issue