Skip to content

Commit

Permalink
chore(tests): Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
yunier-rojas committed Mar 3, 2024
1 parent 55254d1 commit 83f4387
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
8 changes: 2 additions & 6 deletions pipeline/authn/authenticator_delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,13 @@ func (a *AuthenticatorDelegate) GetID() string {
return "delegate"
}

func (a *AuthenticatorDelegate) Validate(config json.RawMessage) error {
func (a *AuthenticatorDelegate) Validate(_ json.RawMessage) error {
if !a.c.AuthenticatorIsEnabled(a.GetID()) {
return NewErrAuthenticatorNotEnabled(a)
}

if err := a.c.AuthenticatorConfig(a.GetID(), config, nil); err != nil {
return NewErrAuthenticatorMisconfigured(a, err)
}
return nil
}

func (a *AuthenticatorDelegate) Authenticate(r *http.Request, session *AuthenticationSession, config json.RawMessage, _ pipeline.Rule) error {
func (a *AuthenticatorDelegate) Authenticate(r *http.Request, _ *AuthenticationSession, _ json.RawMessage, _ pipeline.Rule) error {
return ErrAuthenticatorDelegate
}
10 changes: 0 additions & 10 deletions proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,7 @@ func TestProxy(t *testing.T) {
rulesRegexp: []rule.Rule{ruleDelegateAuthenticator},
rulesGlob: []rule.Rule{ruleDelegateAuthenticatorGlob},
code: http.StatusOK,
transform: func(r *http.Request) {
r.Header.Add("Authorization", "bearer token")
},
messages: []string{
"authorization=bearer token",
"url=/authn-delegate/1234",
"host=" + x.ParseURLOrPanic(backend.URL).Host,
},
},
Expand All @@ -452,12 +447,7 @@ func TestProxy(t *testing.T) {
rulesRegexp: []rule.Rule{ruleDelegateAuthenticatorModifyUpstream},
rulesGlob: []rule.Rule{ruleDelegateAuthenticatorModifyUpstreamGlob},
code: http.StatusOK,
transform: func(r *http.Request) {
r.Header.Add("Authorization", "bearer token")
},
messages: []string{
"authorization=bearer token",
"url=/authn-delegate/1234",
"host=" + x.ParseURLOrPanic(ts.URL).Host,
},
},
Expand Down

0 comments on commit 83f4387

Please sign in to comment.