feat: guarddog-nexus — webhook-based PyPI scanner with web UI
This commit is contained in:
28
tests/test_scanner.py
Normal file
28
tests/test_scanner.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Tests for GuardDog scanner integration."""
|
||||
|
||||
from guarddog_nexus.scanner import _normalize_output
|
||||
|
||||
|
||||
def test_normalize_clean_output(guarddog_output_clean):
|
||||
result = _normalize_output(guarddog_output_clean)
|
||||
assert len(result["findings"]) == 0
|
||||
assert len(result["errors"]) == 0
|
||||
|
||||
|
||||
def test_normalize_flagged_output(guarddog_output_flagged):
|
||||
result = _normalize_output(guarddog_output_flagged)
|
||||
assert len(result["findings"]) == 2
|
||||
assert result["findings"][0]["rule"] == "shady-links"
|
||||
assert result["findings"][0]["severity"] == "WARNING"
|
||||
assert result["findings"][1]["rule"] == "exec-base64"
|
||||
assert result["findings"][1]["severity"] == "ERROR"
|
||||
|
||||
|
||||
def test_normalize_issues_format():
|
||||
data = {
|
||||
"issues": [{"id": "test-rule", "severity": "ERROR", "description": "Bad"}],
|
||||
"errors": [],
|
||||
}
|
||||
result = _normalize_output(data)
|
||||
assert len(result["findings"]) == 1
|
||||
assert result["findings"][0]["rule"] == "test-rule"
|
||||
Reference in New Issue
Block a user