feat(service): add wait_for_approval and return the cache for a login with no prompt

A pair code shown in a log line never answers a prompt, so the server read that login as anonymous and kept the session cache.
This commit is contained in:
imSp4rky
2026-10-07 09:03:18 -06:00
parent 3fd69e8039
commit 5b0369e63a
12 changed files with 97 additions and 36 deletions
+2 -1
View File
@@ -221,11 +221,12 @@ def _run_session(monkeypatch, tmp_path, data, answer, server_account=False, fail
@pytest.mark.parametrize(
"data, answer, server_account, fail, expected",
[
({}, None, False, False, False), # anonymous login through the server: stays the server's
({}, None, False, False, True), # no prompt: a pair code shown in the log, approved on another device
({}, "CODE", False, False, True), # device code the client approved
({}, "CODE", False, True, False), # answered, but the login failed
({}, "CODE", True, False, False), # server account OTP answered by the client
({"cache": "tokens"}, None, False, False, True), # client uploaded its own earlier login
({}, None, True, False, False), # server account
],
)
def test_client_auth_follows_login_provenance(monkeypatch, tmp_path, data, answer, server_account, fail, expected):