acme/api: Remove unused BackoffChallenge func

The mock has an old func that is no longer used. Remove it.
This commit is contained in:
David Cowden 2020-05-13 04:03:47 -07:00
parent 8556d45c3f
commit 794725bcc3

View file

@ -41,7 +41,6 @@ type mockAcmeAuthority struct {
updateAccount func(provisioner.Interface, string, []string) (*acme.Account, error) updateAccount func(provisioner.Interface, string, []string) (*acme.Account, error)
useNonce func(string) error useNonce func(string) error
validateChallenge func(p provisioner.Interface, accID string, id string, jwk *jose.JSONWebKey) (*acme.Challenge, error) validateChallenge func(p provisioner.Interface, accID string, id string, jwk *jose.JSONWebKey) (*acme.Challenge, error)
backoffChallenge func(p provisioner.Interface, accID, chID string, jwk *jose.JSONWebKey) (time.Duration, error)
ret1 interface{} ret1 interface{}
err error err error
} }
@ -204,17 +203,6 @@ func (m *mockAcmeAuthority) ValidateChallenge(p provisioner.Interface, accID str
} }
} }
func (m *mockAcmeAuthority) BackoffChallenge(p provisioner.Interface, accID, chID string, jwk *jose.JSONWebKey) (time.Duration, error) {
switch {
case m.backoffChallenge != nil:
return m.backoffChallenge(p, accID, chID, jwk)
case m.err != nil:
return -1, m.err
default:
return m.ret1.(time.Duration), m.err
}
}
func TestHandlerGetNonce(t *testing.T) { func TestHandlerGetNonce(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
@ -807,7 +795,7 @@ func TestHandlerGetChallenge(t *testing.T) {
case "processing": case "processing":
assert.Equals(t, res.Header["Cache-Control"], []string{"no-cache"}) assert.Equals(t, res.Header["Cache-Control"], []string{"no-cache"})
assert.Equals(t, res.Header["Retry-After"], []string{tc.ch.RetryAfter}) assert.Equals(t, res.Header["Retry-After"], []string{tc.ch.RetryAfter})
case "valid": case "valid", "invalid":
assert.Equals(t, res.Header["Location"], []string{url}) assert.Equals(t, res.Header["Location"], []string{url})
assert.Equals(t, res.Header["Link"], []string{fmt.Sprintf("<https://ca.smallstep.com/acme/authz/%s>;rel=\"up\"", tc.ch.AuthzID)}) assert.Equals(t, res.Header["Link"], []string{fmt.Sprintf("<https://ca.smallstep.com/acme/authz/%s>;rel=\"up\"", tc.ch.AuthzID)})
} }