Skip to content

Commit

Permalink
augment test for remote auth (#17374)
Browse files Browse the repository at this point in the history
* augment test for remote auth

* new test
  • Loading branch information
memsharded authored Dec 20, 2024
1 parent d819621 commit 003e2cf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/integration/command/user_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

0 comments on commit 003e2cf

Please sign in to comment.