Skip to content

Commit 07c9809

Browse files
committed
Verify JSON output from OAuth reset to cover its recovery response.
Refs #937
1 parent 66b1691 commit 07c9809

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎internal/cli/auth_test.go‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,23 @@ func TestRunAuthHelp(t *testing.T) {
203203
}
204204
}
205205

206+
func TestRunAuthResetJSON(t *testing.T) {
207+
withAuthStore(t)
208+
var stdout, stderr bytes.Buffer
209+
if code := runWithDeps([]string{"auth", "reset", "--json"}, &stdout, &stderr, appDeps{}); code != exitSuccess {
210+
t.Fatalf("exit = %d stderr=%s", code, stderr.String())
211+
}
212+
var payload struct {
213+
Reset bool `json:"reset"`
214+
}
215+
if err := json.Unmarshal(stdout.Bytes(), &payload); err != nil {
216+
t.Fatalf("decode JSON: %v (stdout=%q)", err, stdout.String())
217+
}
218+
if !payload.Reset {
219+
t.Fatalf("payload = %+v, want reset=true", payload)
220+
}
221+
}
222+
206223
func TestRunAuthReset(t *testing.T) {
207224
path := withAuthStore(t)
208225
store, err := oauth.NewStore(oauth.StoreOptions{FilePath: path})

0 commit comments

Comments
 (0)