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:
Jaana Burcu Dogan 2016-08-26 10:13:32 -07:00
parent 75e75ddc3d
commit 68218bf41b
1 changed files with 19 additions and 19 deletions

View File

@ -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)
}
}
}