Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

augment test for remote auth #17374

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/integration/command/user_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,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 @@ -436,3 +440,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