Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cfc78f2

Browse files
committed
remove excess error return
1 parent 0cfa9a7 commit cfc78f2

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

coderd/coderdtest/oidctest/idp.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ func (f *FakeIDP) CreateAuthCode(t testing.TB, state string) string {
604604
// something.
605605
// Essentially this is used to fake the Coderd side of the exchange.
606606
// The flow starts at the user hitting the OIDC login page.
607-
func (f *FakeIDP) OIDCCallback(t testing.TB, state string, idTokenClaims jwt.MapClaims) (*http.Response, error) {
607+
func (f *FakeIDP) OIDCCallback(t testing.TB, state string, idTokenClaims jwt.MapClaims) *http.Response {
608608
t.Helper()
609609
if f.serve {
610610
panic("cannot use OIDCCallback with WithServing. This is only for the in memory usage")
@@ -625,7 +625,7 @@ func (f *FakeIDP) OIDCCallback(t testing.TB, state string, idTokenClaims jwt.Map
625625
_ = resp.Body.Close()
626626
}
627627
})
628-
return resp, nil
628+
return resp
629629
}
630630

631631
// ProviderJSON is the .well-known/configuration JSON

coderd/coderdtest/oidctest/idp_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ func TestFakeIDPBasicFlow(t *testing.T) {
5454
token = oauthToken
5555
})
5656

57-
resp, err := fake.OIDCCallback(t, expectedState, jwt.MapClaims{})
58-
require.NoError(t, err)
57+
resp := fake.OIDCCallback(t, expectedState, jwt.MapClaims{})
5958
require.Equal(t, http.StatusOK, resp.StatusCode)
6059

6160
// Test the user info
62-
_, err = cfg.Provider.UserInfo(ctx, oauth2.StaticTokenSource(token))
61+
_, err := cfg.Provider.UserInfo(ctx, oauth2.StaticTokenSource(token))
6362
require.NoError(t, err)
6463

6564
// Now test it can refresh

coderd/externalauth/externalauth_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,9 @@ func TestConstantQueryParams(t *testing.T) {
486486

487487
// Actually run an auth request. Although it says OIDC, the flow is the same
488488
// for oauth2.
489-
cli, resp := fake.OIDCCallback(t, state, jwt.MapClaims{})
489+
resp := fake.OIDCCallback(t, state, jwt.MapClaims{})
490490
require.True(t, callbackCalled)
491-
491+
require.Equal(t, http.StatusOK, resp.StatusCode)
492492
}
493493

494494
type testConfig struct {

0 commit comments

Comments
 (0)