Add remaining test files
Some checks failed
Release / release (push) Failing after 12s

This commit is contained in:
2026-01-29 21:28:07 +00:00
parent 27a661a50c
commit 2b8aae94f1

19
tests/test_utils.py Normal file
View File

@@ -0,0 +1,19 @@
import pytest
from src.utils import ShellParser
class TestShellParser:
def test_tokenize_simple(self):
tokens = ShellParser.tokenize("echo hello")
assert "echo" in tokens
def test_extract_variables(self):
vars = ShellParser.extract_variables("echo $VAR1 and $VAR2")
assert "VAR1" in vars and "VAR2" in vars
def test_is_safe_command(self):
is_safe, issues = ShellParser.is_safe("ls -la /tmp")
assert is_safe
def test_is_safe_dangerous(self):
is_safe, issues = ShellParser.is_safe("rm -rf $TARGET")
assert not is_safe