mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
added tests
This commit is contained in:
@@ -30,6 +30,7 @@ from kvmd.validators.hw import valid_gpio_pin
|
||||
from kvmd.validators.hw import valid_gpio_pin_optional
|
||||
from kvmd.validators.hw import valid_otg_gadget
|
||||
from kvmd.validators.hw import valid_otg_id
|
||||
from kvmd.validators.hw import valid_otg_ethernet
|
||||
|
||||
|
||||
# =====
|
||||
@@ -117,3 +118,15 @@ def test_ok__valid_otg_id(arg: Any) -> None:
|
||||
def test_fail__valid_otg_id(arg: Any) -> None:
|
||||
with pytest.raises(ValidatorError):
|
||||
print(valid_otg_id(arg))
|
||||
|
||||
|
||||
# =====
|
||||
@pytest.mark.parametrize("arg", ["ECM ", "EeM ", "ncm ", " Rndis"])
|
||||
def test_ok__valid_otg_ethernet(arg: Any) -> None:
|
||||
assert valid_otg_ethernet(arg) == arg.strip().lower()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("arg", ["test", "", None])
|
||||
def test_fail__valid_otg_ethernet(arg: Any) -> None:
|
||||
with pytest.raises(ValidatorError):
|
||||
print(valid_otg_ethernet(arg))
|
||||
|
||||
Reference in New Issue
Block a user