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)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if !tok.Valid() {
|
if !tok.Valid() {
|
||||||
t.Errorf("Token invalid")
|
t.Errorf("got invalid token: %v", tok)
|
||||||
}
|
}
|
||||||
if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" {
|
if got, want := tok.AccessToken, "90d64460d14870c08c81352a05dedd3465940a7c"; got != want {
|
||||||
t.Errorf("Unexpected access token, %#v", tok.AccessToken)
|
t.Errorf("access token = %q; want %q", got, want)
|
||||||
}
|
}
|
||||||
if tok.TokenType != "bearer" {
|
if got, want := tok.TokenType, "bearer"; got != want {
|
||||||
t.Errorf("Unexpected token type, %#v", tok.TokenType)
|
t.Errorf("token type = %q; want %q", got, want)
|
||||||
}
|
}
|
||||||
if tok.Expiry.IsZero() {
|
if got := tok.Expiry.IsZero(); got {
|
||||||
t.Errorf("Unexpected token expiry, %#v", tok.Expiry)
|
t.Errorf("token expiry = %v, want none", got)
|
||||||
}
|
}
|
||||||
scope := tok.Extra("scope")
|
scope := tok.Extra("scope")
|
||||||
if scope != "user" {
|
if got, want := scope, "user"; got != want {
|
||||||
t.Errorf("Unexpected value for scope: %v", scope)
|
t.Errorf("scope = %q; want %q", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,20 +95,20 @@ func TestJWTFetch_BadResponse(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if tok == nil {
|
if tok == nil {
|
||||||
t.Fatalf("token is nil")
|
t.Fatalf("got nil token; want token")
|
||||||
}
|
}
|
||||||
if tok.Valid() {
|
if tok.Valid() {
|
||||||
t.Errorf("token is valid. want invalid.")
|
t.Errorf("got invalid token: %v", tok)
|
||||||
}
|
}
|
||||||
if tok.AccessToken != "" {
|
if got, want := tok.AccessToken, ""; got != want {
|
||||||
t.Errorf("Unexpected non-empty access token %q.", tok.AccessToken)
|
t.Errorf("access token = %q; want %q", got, want)
|
||||||
}
|
}
|
||||||
if want := "bearer"; tok.TokenType != want {
|
if got, want := tok.TokenType, "bearer"; got != want {
|
||||||
t.Errorf("TokenType = %q; want %q", tok.TokenType, want)
|
t.Errorf("token type = %q; want %q", got, want)
|
||||||
}
|
}
|
||||||
scope := tok.Extra("scope")
|
scope := tok.Extra("scope")
|
||||||
if want := "user"; scope != want {
|
if got, want := scope, "user"; got != want {
|
||||||
t.Errorf("token scope = %q; want %q", scope, 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()
|
tok, err := conf.TokenSource(context.Background()).Token()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Error("got a token; expected error")
|
t.Error("got a token; expected error")
|
||||||
if tok.AccessToken != "" {
|
if got, want := tok.AccessToken, ""; got != want {
|
||||||
t.Errorf("Unexpected access token, %#v.", tok.AccessToken)
|
t.Errorf("access token = %q; want %q", got, want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue