summaryrefslogtreecommitdiff
path: root/testenv/tests
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-09 03:58:43 +0300
committerDevaev Maxim <[email protected]>2020-09-09 03:58:43 +0300
commit2211124ecba827c916882f3a291d8b227ea5fdcf (patch)
tree568e90db3c77ba15479d43b8187beea313b3adb5 /testenv/tests
parent9c78f4f631facc41df099e5b6b318d0b9e665adc (diff)
tests
Diffstat (limited to 'testenv/tests')
-rw-r--r--testenv/tests/validators/test_hw.py2
-rw-r--r--testenv/tests/validators/test_kvm.py15
2 files changed, 17 insertions, 0 deletions
diff --git a/testenv/tests/validators/test_hw.py b/testenv/tests/validators/test_hw.py
index a10a5feb..912f8f5e 100644
--- a/testenv/tests/validators/test_hw.py
+++ b/testenv/tests/validators/test_hw.py
@@ -82,6 +82,7 @@ def test_fail__valid_gpio_pin_optional(arg: Any) -> None:
"_",
"_foo_bar_",
" aix",
+ "a" * 255,
])
def test_ok__valid_otg_gadget(arg: Any) -> None:
assert valid_otg_gadget(arg) == arg.strip()
@@ -93,6 +94,7 @@ def test_ok__valid_otg_gadget(arg: Any) -> None:
"te~st",
"-",
"-foo_bar",
+ "a" * 256,
" ",
"",
None,
diff --git a/testenv/tests/validators/test_kvm.py b/testenv/tests/validators/test_kvm.py
index 0fdf6a9a..61f5a7be 100644
--- a/testenv/tests/validators/test_kvm.py
+++ b/testenv/tests/validators/test_kvm.py
@@ -29,6 +29,7 @@ from kvmd.keyboard.mappings import KEYMAP
from kvmd.validators import ValidatorError
from kvmd.validators.kvm import valid_atx_power_action
from kvmd.validators.kvm import valid_atx_button
+from kvmd.validators.kvm import valid_info_fields
from kvmd.validators.kvm import valid_log_seek
from kvmd.validators.kvm import valid_stream_quality
from kvmd.validators.kvm import valid_stream_fps
@@ -64,6 +65,20 @@ def test_fail__valid_atx_button(arg: Any) -> None:
# =====
[email protected]("arg", [" foo ", "bar", "foo, ,bar,", " ", " , ", ""])
+def test_ok__valid_info_fields(arg: Any) -> None:
+ value = valid_info_fields(arg, set(["foo", "bar"]))
+ assert type(value) == set # pylint: disable=unidiomatic-typecheck
+ assert value == set(filter(None, map(str.strip, str(arg).split(","))))
+
+
[email protected]("arg", ["xxx", "yyy", "foo,xxx", None])
+def test_fail__valid_info_fields(arg: Any) -> None:
+ with pytest.raises(ValidatorError):
+ print(valid_info_fields(arg, set(["foo", "bar"])))
+
+
+# =====
@pytest.mark.parametrize("arg", ["0 ", 0, 1, 13])
def test_ok__valid_log_seek(arg: Any) -> None:
value = valid_log_seek(arg)