Skip to content

Commit

Permalink
cmd/cue: add more sanity checks for produced logins.json files
Browse files Browse the repository at this point in the history
The following commit will resolve the TODO.

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I9c3488f6d778854e9076860b4311448689fe7fc5
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202034
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Roger Peppe <[email protected]>
  • Loading branch information
mvdan committed Oct 1, 2024
1 parent f0c77ed commit 791420a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/cue/cmd/testdata/script/login_immediate.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,15 @@ oauthregistry immediate-success

exec cue login
stdout 'open:.*user_code=user-code'
grep 'secret-access-token' cueconfig/logins.json

# Ensure that only one token is stored.
grep -count=1 '"registries": {' cueconfig/logins.json
grep -count=1 '"access_token"' cueconfig/logins.json

# Ensure the contents of the token look correct.
grep -count=1 '"access_token": "secret-access-token"' cueconfig/logins.json
grep -count=1 '"token_type": "Bearer"' cueconfig/logins.json
# TODO(mvdan): oauthregistry does not provide expires_in correctly.
! grep '"expiry": ' cueconfig/logins.json
# oauthregistry does not give a refresh token, and we use encoding/json's omitempty.
! grep '"refresh_token"' cueconfig/logins.json

0 comments on commit 791420a

Please sign in to comment.