Skip to content

Commit 791420a

Browse files
committed
cmd/cue: add more sanity checks for produced logins.json files
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]>
1 parent f0c77ed commit 791420a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmd/cue/cmd/testdata/script/login_immediate.txtar

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,15 @@ oauthregistry immediate-success
66

77
exec cue login
88
stdout 'open:.*user_code=user-code'
9-
grep 'secret-access-token' cueconfig/logins.json
9+
10+
# Ensure that only one token is stored.
11+
grep -count=1 '"registries": {' cueconfig/logins.json
12+
grep -count=1 '"access_token"' cueconfig/logins.json
13+
14+
# Ensure the contents of the token look correct.
15+
grep -count=1 '"access_token": "secret-access-token"' cueconfig/logins.json
16+
grep -count=1 '"token_type": "Bearer"' cueconfig/logins.json
17+
# TODO(mvdan): oauthregistry does not provide expires_in correctly.
18+
! grep '"expiry": ' cueconfig/logins.json
19+
# oauthregistry does not give a refresh token, and we use encoding/json's omitempty.
20+
! grep '"refresh_token"' cueconfig/logins.json

0 commit comments

Comments
 (0)