29 lines
974 B
Python
29 lines
974 B
Python
"""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"
|