From 003e2cfb746dbc83370758c192edacebd761472b Mon Sep 17 00:00:00 2001 From: James Date: Fri, 20 Dec 2024 02:33:05 +0100 Subject: [PATCH] augment test for remote auth (#17374) * augment test for remote auth * new test --- test/integration/command/user_test.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/integration/command/user_test.py b/test/integration/command/user_test.py index 66191a62187..a5db579f0cb 100644 --- a/test/integration/command/user_test.py +++ b/test/integration/command/user_test.py @@ -430,6 +430,10 @@ def test_remote_auth_server_expire_token_secret(self): "user", "pass", "user", "pass", "user", "pass"]) c.run("remote auth *") + assert "Remote 'default' needs authentication, obtaining credentials" in c.out + assert "user: myuser" in c.out + c.run("remote auth *") + assert "Remote 'default' needs authentication, obtaining credentials" not in c.out assert "user: myuser" in c.out # Invalidate server secret server.test_server.ra.api_v2.credentials_manager.secret = "potato" @@ -460,3 +464,15 @@ def test_remote_auth_server_expire_token(self): time.sleep(3) c.run("remote auth *") assert "error: Too many failed login attempts, bye!" in c.out + + def test_auth_after_logout(self): + server = TestServer(users={"myuser": "password"}) + c = TestClient(servers={"default": server}, inputs=["myuser", "password"]*2) + c.run("remote auth *") + assert "Remote 'default' needs authentication, obtaining credentials" in c.out + assert "user: myuser" in c.out + c.run("remote logout *") + assert "Changed user of remote 'default' from 'myuser' (authenticated) to 'None'" in c.out + c.run("remote auth *") + assert "Remote 'default' needs authentication, obtaining credentials" in c.out + assert "user: myuser" in c.out