diff options
author | Jaana Burcu Dogan <jbd@google.com> | 2016-08-26 11:51:24 -0700 |
---|---|---|
committer | Jaana Burcu Dogan <jbd@google.com> | 2016-08-26 21:49:23 +0000 |
commit | e839600e667558ee911f25df4f44b69cb1a743ff (patch) | |
tree | 5f51d2b0a523ba39995a2ead0411e1a4899e760d /transport_test.go | |
parent | 68218bf41b4d536352e1c55976641958d65c409b (diff) | |
download | golang-x-oauth2-e839600e667558ee911f25df4f44b69cb1a743ff.tar.gz |
oauth2, jws, internal: more style fixes for bad test messages
Change-Id: Id2805fd77fb11d975414eb66689efab284a18805
Reviewed-on: https://go-review.googlesource.com/27911
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'transport_test.go')
-rw-r--r-- | transport_test.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/transport_test.go b/transport_test.go index 9bb1383..d6e8087 100644 --- a/transport_test.go +++ b/transport_test.go @@ -18,12 +18,12 @@ func TestTransportNilTokenSource(t *testing.T) { server := newMockServer(func(w http.ResponseWriter, r *http.Request) {}) defer server.Close() client := &http.Client{Transport: tr} - res, err := client.Get(server.URL) + resp, err := client.Get(server.URL) if err == nil { - t.Errorf("a nil Source was passed into the transport expected an error") + t.Errorf("got no errors, want an error with nil token source") } - if res != nil { - t.Errorf("expected a nil response, got %v", res) + if resp != nil { + t.Errorf("Response = %v; want nil", resp) } } @@ -37,8 +37,8 @@ func TestTransportTokenSource(t *testing.T) { Source: ts, } server := newMockServer(func(w http.ResponseWriter, r *http.Request) { - if r.Header.Get("Authorization") != "Bearer abc" { - t.Errorf("Transport doesn't set the Authorization header from the fetched token") + if got, want := r.Header.Get("Authorization"), "Bearer abc"; got != want { + t.Errorf("Authorization header = %q; want %q", got, want) } }) defer server.Close() @@ -90,7 +90,7 @@ func TestTransportTokenSourceTypes(t *testing.T) { func TestTokenValidNoAccessToken(t *testing.T) { token := &Token{} if token.Valid() { - t.Errorf("Token should not be valid with no access token") + t.Errorf("got valid with no access token; want invalid") } } @@ -99,7 +99,7 @@ func TestExpiredWithExpiry(t *testing.T) { Expiry: time.Now().Add(-5 * time.Hour), } if token.Valid() { - t.Errorf("Token should not be valid if it expired in the past") + t.Errorf("got valid with expired token; want invalid") } } |