fix: resolve CI import and type mismatch issues
Some checks failed
Some checks failed
This commit is contained in:
44
tests/test_models.py
Normal file
44
tests/test_models.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
"""Tests for core models."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from src.core.models import Issue, IssueCategory, ScanResult, SeverityLevel
|
||||||
|
|
||||||
|
|
||||||
|
class TestModels:
|
||||||
|
"""Tests for data models."""
|
||||||
|
|
||||||
|
def test_issue_creation(self):
|
||||||
|
"""Test Issue dataclass creation."""
|
||||||
|
issue = Issue(
|
||||||
|
category=IssueCategory.SECURITY,
|
||||||
|
severity=SeverityLevel.HIGH,
|
||||||
|
file_path="test.py",
|
||||||
|
line_number=10,
|
||||||
|
message="Security issue found",
|
||||||
|
)
|
||||||
|
assert issue.category == IssueCategory.SECURITY
|
||||||
|
assert issue.severity == SeverityLevel.HIGH
|
||||||
|
assert issue.file_path == "test.py"
|
||||||
|
assert issue.line_number == 10
|
||||||
|
assert issue.message == "Security issue found"
|
||||||
|
|
||||||
|
def test_scan_result_creation(self):
|
||||||
|
"""Test ScanResult dataclass creation."""
|
||||||
|
result = ScanResult(
|
||||||
|
issues=[],
|
||||||
|
warnings=[],
|
||||||
|
files_scanned=5,
|
||||||
|
scan_time=1.5,
|
||||||
|
)
|
||||||
|
assert result.issues == []
|
||||||
|
assert result.warnings == []
|
||||||
|
assert result.files_scanned == 5
|
||||||
|
assert result.scan_time == 1.5
|
||||||
|
|
||||||
|
def test_severity_level_ordering(self):
|
||||||
|
"""Test SeverityLevel enum values."""
|
||||||
|
assert SeverityLevel.LOW.value == "low"
|
||||||
|
assert SeverityLevel.MEDIUM.value == "medium"
|
||||||
|
assert SeverityLevel.HIGH.value == "high"
|
||||||
|
assert SeverityLevel.CRITICAL.value == "critical"
|
||||||
Reference in New Issue
Block a user