diff options
author | Devaev Maxim <[email protected]> | 2019-04-10 21:40:34 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-04-10 21:40:34 +0300 |
commit | 07c59485fcef43a8a3dc122d05c7352a3da8aa15 (patch) | |
tree | ed03ed4c9a314f1be301f90cc5bba64eff4ecbc7 /tests/test_validators_fs.py | |
parent | 4eb89c9399d3bd440577d275a9c07578c2f47484 (diff) |
moar validators
Diffstat (limited to 'tests/test_validators_fs.py')
-rw-r--r-- | tests/test_validators_fs.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_validators_fs.py b/tests/test_validators_fs.py index 854d025c..c2f13393 100644 --- a/tests/test_validators_fs.py +++ b/tests/test_validators_fs.py @@ -22,6 +22,7 @@ import os +from typing import List from typing import Any import pytest @@ -30,6 +31,7 @@ from kvmd.validators import ValidatorError from kvmd.validators.fs import valid_abs_path from kvmd.validators.fs import valid_abs_path_exists from kvmd.validators.fs import valid_unix_mode +from kvmd.validators.fs import valid_command # ===== @@ -89,3 +91,28 @@ def test_ok__valid_unix_mode(arg: Any) -> None: def test_fail__valid_unix_mode(arg: Any) -> None: with pytest.raises(ValidatorError): print(valid_unix_mode(arg)) + + +# ===== [email protected]("arg, retval", [ + (["/bin/true"], ["/bin/true"]), + (["/bin/true", 1, 2, 3], ["/bin/true", "1", "2", "3"]), + ("/bin/true, 1, 2, 3,", ["/bin/true", "1", "2", "3"]), + ("/bin/true", ["/bin/true"]), +]) +def test_ok__valid_command(arg: Any, retval: List[str]) -> None: + assert valid_command(arg) == retval + + [email protected]("arg", [ + ["/bin/blahblahblah"], + ["/bin/blahblahblah", 1, 2, 3], + [" "], + [], + "/bin/blahblahblah, 1, 2, 3,", + "/bin/blahblahblah", + " ", +]) +def test_fail__valid_command(arg: Any) -> None: + with pytest.raises(ValidatorError): + print(valid_command(arg)) |