summaryrefslogtreecommitdiff
path: root/testenv
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2023-03-06 04:18:38 +0200
committerMaxim Devaev <[email protected]>2023-03-06 04:18:38 +0200
commit7667834b6de23ce71ea2e805f6a50eb679444b9e (patch)
treefac801c7d5372d0c7e4c218393d823a3a4cf9954 /testenv
parent5495f70564e03ae0d6ac81866a37cdd79858d4e4 (diff)
structly validation
Diffstat (limited to 'testenv')
-rw-r--r--testenv/tests/validators/test_kvm.py23
-rw-r--r--testenv/tests/validators/test_os.py18
2 files changed, 14 insertions, 27 deletions
diff --git a/testenv/tests/validators/test_kvm.py b/testenv/tests/validators/test_kvm.py
index f9990194..c3c2eea9 100644
--- a/testenv/tests/validators/test_kvm.py
+++ b/testenv/tests/validators/test_kvm.py
@@ -72,20 +72,12 @@ def test_fail__valid_atx_button(arg: Any) -> None:
("\n" + "x" * 1000, "x" * 255),
("test", "test"),
("test test [test] #test$", "test test [test] #test$"),
- (".test", ".test"),
- ("..test", "..test"),
- ("..тест..", "..тест.."),
- ("..те\\ст..", "..те\\ст.."),
- (".....", "....."),
- (".....txt", ".....txt"),
- (" .. .", ".. ."),
- ("..\n.", ".._."),
- ("test/", "test"),
- ("/test", "test"),
- ("foo/bar.iso", "foo/bar.iso"),
- ("//foo//bar.iso", "foo/bar.iso"),
- ("foo/lost-found/bar.iso", "foo/lost-found/bar.iso"),
- ("/bar.iso/", "bar.iso"),
+ ("test/", "test"),
+ ("/test", "test"),
+ ("foo/bar.iso", "foo/bar.iso"),
+ ("//foo//bar.iso", "foo/bar.iso"),
+ ("foo/lost-found/bar.iso", "foo/lost-found/bar.iso"),
+ ("/bar.iso/", "bar.iso"),
])
def test_ok__valid_msd_image_name(arg: Any, retval: str) -> None:
@@ -104,12 +96,13 @@ def test_ok__valid_msd_image_name(arg: Any, retval: str) -> None:
"/ ..",
".. /",
"/.. /",
+ ".test",
"foo/../bar.iso",
"foo/./foo.iso",
"foo/lost+found/bar.iso",
"../bar.iso",
"/../bar.iso",
- "foo/.__bar.iso",
+ "foo/.bar.iso",
"",
" ",
None,
diff --git a/testenv/tests/validators/test_os.py b/testenv/tests/validators/test_os.py
index cabb8e51..9b229014 100644
--- a/testenv/tests/validators/test_os.py
+++ b/testenv/tests/validators/test_os.py
@@ -86,18 +86,10 @@ def test_fail__valid_abs_path__dir(arg: Any) -> None:
("dsl-4.11.rc1.iso", "dsl-4.11.rc1.iso"),
("systemrescuecd-x86-5.3.1.iso", "systemrescuecd-x86-5.3.1.iso"),
("ubuntu-16.04.5-desktop-i386.iso", "ubuntu-16.04.5-desktop-i386.iso"),
- (" тест(){}[ \t].iso\t", "тест(){}[ _].iso"),
- ("\n" + "x" * 1000, "x" * 255),
- ("test", "test"),
- ("test test [test] #test$", "test test [test] #test$"),
- (".test", ".test"),
- ("..test", "..test"),
- ("..тест..", "..тест.."),
- ("..те\\ст..", "..те\\ст.."),
- (".....", "....."),
- (".....txt", ".....txt"),
- (" .. .", ".. ."),
- ("..\n.", ".._."),
+ (" тест(){}[ \t].iso\t", "тест(){}[ _].iso"),
+ ("\n" + "x" * 1000, "x" * 255),
+ ("test", "test"),
+ ("test test [test] #test$", "test test [test] #test$"),
])
def test_ok__valid_printable_filename(arg: Any, retval: str) -> None:
assert valid_printable_filename(arg) == retval
@@ -110,6 +102,7 @@ def test_ok__valid_printable_filename(arg: Any, retval: str) -> None:
"test/",
"/test",
"../test",
+ ".test",
"./.",
"../.",
"./..",
@@ -117,6 +110,7 @@ def test_ok__valid_printable_filename(arg: Any, retval: str) -> None:
"/ ..",
".. /",
"/.. /",
+ "lost+found",
"",
" ",
None,