mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 09:01:54 +08:00
pikvm/pikvm#1204: Expire user session
This commit is contained in:
@@ -28,6 +28,7 @@ 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_expire
|
||||
from kvmd.validators.auth import valid_auth_token
|
||||
|
||||
|
||||
@@ -109,6 +110,20 @@ def test_fail__valid_passwd(arg: Any) -> None:
|
||||
print(valid_passwd(arg))
|
||||
|
||||
|
||||
# =====
|
||||
@pytest.mark.parametrize("arg", ["0 ", 0, 1, 13])
|
||||
def test_ok__valid_expire(arg: Any) -> None:
|
||||
value = valid_expire(arg)
|
||||
assert type(value) is int # pylint: disable=unidiomatic-typecheck
|
||||
assert value == int(str(arg).strip())
|
||||
|
||||
|
||||
@pytest.mark.parametrize("arg", ["test", "", None, -1, -13, 1.1])
|
||||
def test_fail__valid_expire(arg: Any) -> None:
|
||||
with pytest.raises(ValidatorError):
|
||||
print(valid_expire(arg))
|
||||
|
||||
|
||||
# =====
|
||||
@pytest.mark.parametrize("arg", [
|
||||
("0" * 64) + " ",
|
||||
|
||||
Reference in New Issue
Block a user