forked from Mirrors/oauth2
jwt: fix bad test message style
Change-Id: I84c311778a1ad3e824e65c1e797223f51f0bc2ea Reviewed-on: https://go-review.googlesource.com/27890 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
75e75ddc3d
commit
68218bf41b
|
@ -61,20 +61,20 @@ func TestJWTFetch_JSONResponse(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
if !tok.Valid() {
|
||||
t.Errorf("Token invalid")
|
||||
t.Errorf("got invalid token: %v", tok)
|
||||
}
|
||||
if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" {
|
||||
t.Errorf("Unexpected access token, %#v", tok.AccessToken)
|
||||
if got, want := tok.AccessToken, "90d64460d14870c08c81352a05dedd3465940a7c"; got != want {
|
||||
t.Errorf("access token = %q; want %q", got, want)
|
||||
}
|
||||
if tok.TokenType != "bearer" {
|
||||
t.Errorf("Unexpected token type, %#v", tok.TokenType)
|
||||
if got, want := tok.TokenType, "bearer"; got != want {
|
||||
t.Errorf("token type = %q; want %q", got, want)
|
||||
}
|
||||
if tok.Expiry.IsZero() {
|
||||
t.Errorf("Unexpected token expiry, %#v", tok.Expiry)
|
||||
if got := tok.Expiry.IsZero(); got {
|
||||
t.Errorf("token expiry = %v, want none", got)
|
||||
}
|
||||
scope := tok.Extra("scope")
|
||||
if scope != "user" {
|
||||
t.Errorf("Unexpected value for scope: %v", scope)
|
||||
if got, want := scope, "user"; got != want {
|
||||
t.Errorf("scope = %q; want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,20 +95,20 @@ func TestJWTFetch_BadResponse(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
if tok == nil {
|
||||
t.Fatalf("token is nil")
|
||||
t.Fatalf("got nil token; want token")
|
||||
}
|
||||
if tok.Valid() {
|
||||
t.Errorf("token is valid. want invalid.")
|
||||
t.Errorf("got invalid token: %v", tok)
|
||||
}
|
||||
if tok.AccessToken != "" {
|
||||
t.Errorf("Unexpected non-empty access token %q.", tok.AccessToken)
|
||||
if got, want := tok.AccessToken, ""; got != want {
|
||||
t.Errorf("access token = %q; want %q", got, want)
|
||||
}
|
||||
if want := "bearer"; tok.TokenType != want {
|
||||
t.Errorf("TokenType = %q; want %q", tok.TokenType, want)
|
||||
if got, want := tok.TokenType, "bearer"; got != want {
|
||||
t.Errorf("token type = %q; want %q", got, want)
|
||||
}
|
||||
scope := tok.Extra("scope")
|
||||
if want := "user"; scope != want {
|
||||
t.Errorf("token scope = %q; want %q", scope, want)
|
||||
if got, want := scope, "user"; got != want {
|
||||
t.Errorf("token scope = %q; want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,8 +126,8 @@ func TestJWTFetch_BadResponseType(t *testing.T) {
|
|||
tok, err := conf.TokenSource(context.Background()).Token()
|
||||
if err == nil {
|
||||
t.Error("got a token; expected error")
|
||||
if tok.AccessToken != "" {
|
||||
t.Errorf("Unexpected access token, %#v.", tok.AccessToken)
|
||||
if got, want := tok.AccessToken, ""; got != want {
|
||||
t.Errorf("access token = %q; want %q", got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue