Skip to content

Commit a95c923

Browse files
committed
address nits
1 parent eeb1a08 commit a95c923

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

google/externalaccount/basecredentials_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,10 @@ func TestToken(t *testing.T) {
241241
Scopes: []string{"https://www.googleapis.com/auth/devstorage.full_control"},
242242
}
243243

244-
responseBody, _ := json.Marshal(testCase.responseBody)
244+
responseBody, err := json.Marshal(testCase.responseBody)
245+
if err != nil {
246+
t.Errorf("Invalid response received.")
247+
}
245248

246249
server := testExchangeTokenServer{
247250
url: "/",
@@ -254,10 +257,8 @@ func TestToken(t *testing.T) {
254257

255258
tok, err := run(t, &config, &server)
256259

257-
if err != nil {
258-
if err.Error() != testCase.expectErrorMsg {
259-
t.Errorf("Error actual = %v, and Expect = %v", err, testCase.expectErrorMsg)
260-
}
260+
if err != nil && err.Error() != testCase.expectErrorMsg {
261+
t.Errorf("Error not as expected: got = %v, and want = %v", err, testCase.expectErrorMsg)
261262
}
262263
validateToken(t, tok, testCase.expectToken)
263264
}

0 commit comments

Comments
 (0)