handler_test: Add BackoffChallenge

The mock acme authority needs to in order to conform to the updated acme
authority interface.
This commit is contained in:
David Cowden 2020-04-30 04:41:49 -07:00
parent 8fb558da10
commit f56c449ea4

View file

@ -41,6 +41,7 @@ type mockAcmeAuthority struct {
updateAccount func(provisioner.Interface, string, []string) (*acme.Account, error)
useNonce func(string) 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{}
err error
}
@ -203,6 +204,17 @@ 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) {
tests := []struct {
name string