summaryrefslogtreecommitdiff
path: root/testenv
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-01-08 23:50:38 +0200
committerMaxim Devaev <[email protected]>2024-01-08 23:50:38 +0200
commit0676a3cee927e96693773369a458acbd7ed786bc (patch)
tree3bae0fd998b49af7d3eb25ebe38c355c17bf7aac /testenv
parentf355c38fe18968475bce1b04b1b1b22fae37ff23 (diff)
unique token for each separate logins
Diffstat (limited to 'testenv')
-rw-r--r--testenv/tests/apps/kvmd/test_auth.py37
1 files changed, 24 insertions, 13 deletions
diff --git a/testenv/tests/apps/kvmd/test_auth.py b/testenv/tests/apps/kvmd/test_auth.py
index 12be04a1..402c9273 100644
--- a/testenv/tests/apps/kvmd/test_auth.py
+++ b/testenv/tests/apps/kvmd/test_auth.py
@@ -100,19 +100,30 @@ async def test_ok__internal(tmpdir) -> None: # type: ignore
assert (await manager.login("admin", "foo")) is None
assert (await manager.login("user", "pass")) is None
- token = await manager.login("admin", "pass")
- assert isinstance(token, str)
- assert len(token) == 64
-
- again = await manager.login("admin", "pass")
- assert token == again
-
- assert manager.check(token) == "admin"
- manager.logout(token)
- assert manager.check(token) is None
-
- again = await manager.login("admin", "pass")
- assert token != again
+ token1 = await manager.login("admin", "pass")
+ assert isinstance(token1, str)
+ assert len(token1) == 64
+
+ token2 = await manager.login("admin", "pass")
+ assert isinstance(token2, str)
+ assert len(token2) == 64
+ assert token1 != token2
+
+ assert manager.check(token1) == "admin"
+ assert manager.check(token2) == "admin"
+ assert manager.check("foobar") is None
+
+ manager.logout(token1)
+
+ assert manager.check(token1) is None
+ assert manager.check(token2) is None
+ assert manager.check("foobar") is None
+
+ token3 = await manager.login("admin", "pass")
+ assert isinstance(token3, str)
+ assert len(token3) == 64
+ assert token1 != token3
+ assert token2 != token3
@pytest.mark.asyncio