certificates/authority/webhook_test.go

28 lines
610 B
Go
Raw Normal View History

2022-09-30 00:16:26 +00:00
package authority
import (
"github.com/smallstep/certificates/authority/provisioner"
"github.com/smallstep/certificates/webhook"
)
type mockWebhookController struct {
enrichErr error
authorizeErr error
templateData provisioner.WebhookSetter
respData map[string]any
}
var _ webhookController = &mockWebhookController{}
2023-05-10 06:47:28 +00:00
func (wc *mockWebhookController) Enrich(*webhook.RequestBody) error {
2022-09-30 00:16:26 +00:00
for key, data := range wc.respData {
wc.templateData.SetWebhook(key, data)
}
return wc.enrichErr
}
2023-05-10 06:47:28 +00:00
func (wc *mockWebhookController) Authorize(*webhook.RequestBody) error {
2022-09-30 00:16:26 +00:00
return wc.authorizeErr
}