google: fix spelling and go fmt

Change-Id: Ifc55814018bf66d2e77752d770a51c716376cabc
This commit is contained in:
Patrick Jones 2020-11-18 11:03:03 -08:00
parent aa7010ab25
commit a17de82d3e
2 changed files with 8 additions and 8 deletions

View File

@ -16,7 +16,7 @@ import (
"strings" "strings"
) )
// ExchangeToken preforms a oauth2 token exchange with the provided endpoint. // ExchangeToken performs an oauth2 token exchange with the provided endpoint.
// The first 4 fields are all mandatory. headers can be used to pass additional // The first 4 fields are all mandatory. headers can be used to pass additional
// headers beyond the bare minimum required by the token exchange. options can // headers beyond the bare minimum required by the token exchange. options can
// be used to pass additional JSON-structured options to the remote server. // be used to pass additional JSON-structured options to the remote server.
@ -67,7 +67,6 @@ func ExchangeToken(ctx context.Context, endpoint string, request *STSTokenExchan
} }
return &stsResp, nil return &stsResp, nil
} }

View File

@ -57,7 +57,7 @@ func TestExchangeToken(t *testing.T) {
if got, want := r.Header.Get("Authorization"), "Basic cmJyZ25vZ25yaG9uZ28zYmk0Z2I5Z2hnOWc6bm90c29zZWNyZXQ="; got != want { if got, want := r.Header.Get("Authorization"), "Basic cmJyZ25vZ25yaG9uZ28zYmk0Z2I5Z2hnOWc6bm90c29zZWNyZXQ="; got != want {
t.Errorf("Unexpected authorization header, got %v, want %v", got, want) t.Errorf("Unexpected authorization header, got %v, want %v", got, want)
} }
if got, want := r.Header.Get("Content-Type"), "application/x-www-form-urlencoded"; got != want{ if got, want := r.Header.Get("Content-Type"), "application/x-www-form-urlencoded"; got != want {
t.Errorf("Unexpected Content-Type header, got %v, want %v", got, want) t.Errorf("Unexpected Content-Type header, got %v, want %v", got, want)
} }
body, err := ioutil.ReadAll(r.Body) body, err := ioutil.ReadAll(r.Body)
@ -84,8 +84,6 @@ func TestExchangeToken(t *testing.T) {
t.Errorf("mismatched messages received by mock server. \nWant: \n%v\n\nGot:\n%v", expectedToken, *resp) t.Errorf("mismatched messages received by mock server. \nWant: \n%v\n\nGot:\n%v", expectedToken, *resp)
} }
} }
func TestExchangeToken_Err(t *testing.T) { func TestExchangeToken_Err(t *testing.T) {
@ -102,12 +100,15 @@ func TestExchangeToken_Err(t *testing.T) {
t.Errorf("Expected handled error; instead got nil.") t.Errorf("Expected handled error; instead got nil.")
} }
} }
/* Lean test specifically for options, as the other features are tested earlier. */ /* Lean test specifically for options, as the other features are tested earlier. */
type testOpts struct { type testOpts struct {
First string `json:"first"` First string `json:"first"`
Second string `json:"second"` Second string `json:"second"`
} }
var optsValues = [][]string{{"foo", "bar"},{"cat", "pan"}}
var optsValues = [][]string{{"foo", "bar"}, {"cat", "pan"}}
func TestExchangeToken_Opts(t *testing.T) { func TestExchangeToken_Opts(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body) body, err := ioutil.ReadAll(r.Body)