forked from TrueCloudLab/certificates
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:
parent
8fb558da10
commit
f56c449ea4
1 changed files with 12 additions and 0 deletions
|
@ -41,6 +41,7 @@ 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
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
func TestHandlerGetNonce(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
|
Loading…
Reference in a new issue