From 2b8aae94f18d0fa465391cf38c4776c33669eb96 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Thu, 29 Jan 2026 21:28:07 +0000 Subject: [PATCH] Add remaining test files --- tests/test_utils.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/test_utils.py diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 0000000..4cecbc9 --- /dev/null +++ b/tests/test_utils.py @@ -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