Update vendored library google.golang.org/api

This commit is contained in:
Alexander Neumann 2018-03-30 12:51:18 +02:00
parent 5b6568875c
commit c0960f538f
363 changed files with 581827 additions and 452273 deletions

View file

@ -85,46 +85,3 @@ const validServiceAccountJSON = `{
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/dumba-504%40appspot.gserviceaccount.com"
}`
func TestRefreshTokenTokenSource(t *testing.T) {
tests := []struct {
name string
data []byte
wantOK bool
wantErr bool
}{
{
name: "empty",
data: []byte{},
wantOK: false,
wantErr: true, // not valid JSON
},
{
name: "non refresh token JSON",
data: []byte("{}"),
wantOK: false,
wantErr: false,
},
{
name: "service account JSON",
data: []byte(validServiceAccountJSON),
wantOK: false,
wantErr: false,
},
{
name: "valid refresh token JSON",
data: []byte(validRefeshTokenJSON),
wantOK: true,
wantErr: false,
},
}
for _, tt := range tests {
_, ok, err := refreshTokenTokenSource(context.Background(), tt.data)
if (err != nil) != tt.wantErr {
t.Errorf("%v: refreshTokenTokenSource() err = %v, wantErr %v", tt.name, err, tt.wantErr)
}
if ok != tt.wantOK {
t.Errorf("%v: refreshTokenTokenSource() ok = %v, want %v", tt.name, ok, tt.wantOK)
}
}
}