diff options
Diffstat (limited to 'tests/test_validators_auth.py')
-rw-r--r-- | tests/test_validators_auth.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_validators_auth.py b/tests/test_validators_auth.py index cec7efa7..f3cdf939 100644 --- a/tests/test_validators_auth.py +++ b/tests/test_validators_auth.py @@ -20,12 +20,14 @@ # ========================================================================== # +from typing import List from typing import Any import pytest from kvmd.validators import ValidatorError from kvmd.validators.auth import valid_user +from kvmd.validators.auth import valid_users_list from kvmd.validators.auth import valid_passwd from kvmd.validators.auth import valid_auth_token @@ -59,6 +61,27 @@ def test_fail__valid_user(arg: Any) -> None: # ===== [email protected]("arg, retval", [ + ("foo, bar, ", ["foo", "bar"]), + ("foo bar", ["foo", "bar"]), + (["foo", "bar"], ["foo", "bar"]), + ("", []), + (" ", []), + (", ", []), + (", foo, ", ["foo"]), + ([], []), +]) +def test_ok__valid_users_list(arg: Any, retval: List) -> None: + assert valid_users_list(arg) == retval + + [email protected]("arg", [None, [None], [""], [" "], ["user,"]]) +def test_fail__valid_users_list(arg: Any) -> None: # pylint: disable=invalid-name + with pytest.raises(ValidatorError): + print(valid_users_list(arg)) + + +# ===== @pytest.mark.parametrize("arg", [ "glados", "test", |