Add more tests
This commit is contained in:
15
tests/test_validators/test_patterns.py
Normal file
15
tests/test_validators/test_patterns.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import pytest
|
||||
from src.validators import PatternValidator
|
||||
|
||||
class TestPatternValidator:
|
||||
def setup_method(self):
|
||||
self.validator = PatternValidator()
|
||||
|
||||
def test_detect_dangerous_rm(self):
|
||||
findings = self.validator.check("rm -rf $TARGET_DIR")
|
||||
assert len(findings) == 1
|
||||
assert findings[0].rule_id == "DANGER001"
|
||||
|
||||
def test_safe_command(self):
|
||||
findings = self.validator.check("ls -la /tmp")
|
||||
assert len(findings) == 0
|
||||
Reference in New Issue
Block a user