mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
optional quality and resolution
This commit is contained in:
@@ -142,6 +142,7 @@ def test_fail__valid_float_f01(arg: Any) -> None:
|
||||
# =====
|
||||
@pytest.mark.parametrize("arg, retval", [
|
||||
("a, b, c", ["a", "b", "c"]),
|
||||
("a, b,, c", ["a", "b", "c"]),
|
||||
("a b c", ["a", "b", "c"]),
|
||||
(["a", "b", "c"], ["a", "b", "c"]),
|
||||
("", []),
|
||||
|
||||
@@ -32,6 +32,7 @@ from kvmd.validators.kvm import valid_atx_button
|
||||
from kvmd.validators.kvm import valid_log_seek
|
||||
from kvmd.validators.kvm import valid_stream_quality
|
||||
from kvmd.validators.kvm import valid_stream_fps
|
||||
from kvmd.validators.kvm import valid_stream_resolution
|
||||
from kvmd.validators.kvm import valid_hid_key
|
||||
from kvmd.validators.kvm import valid_hid_mouse_move
|
||||
from kvmd.validators.kvm import valid_hid_mouse_button
|
||||
@@ -104,6 +105,20 @@ def test_fail__valid_stream_fps(arg: Any) -> None:
|
||||
print(valid_stream_fps(arg))
|
||||
|
||||
|
||||
# =====
|
||||
@pytest.mark.parametrize("arg", ["1280x720 ", "1x1"])
|
||||
def test_ok__valid_stream_resolution(arg: Any) -> None:
|
||||
value = valid_stream_resolution(arg)
|
||||
assert type(value) == str # pylint: disable=unidiomatic-typecheck
|
||||
assert value == str(arg).strip()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("arg", ["x", None, "0x0", "0x1", "1x0", "1280", "1280x", "1280x720x"])
|
||||
def test_fail__valid_stream_resolution(arg: Any) -> None:
|
||||
with pytest.raises(ValidatorError):
|
||||
print(valid_stream_resolution(arg))
|
||||
|
||||
|
||||
# =====
|
||||
def test_ok__valid_hid_key() -> None:
|
||||
for key in KEYMAP:
|
||||
|
||||
Reference in New Issue
Block a user