forked from TrueCloudLab/certificates
Fix webhook controller ignoring cert type
This commit is contained in:
parent
70abbdfc70
commit
2c5e41b093
2 changed files with 18 additions and 0 deletions
|
@ -86,6 +86,7 @@ func (c *Controller) newWebhookController(templateData WebhookSetter, certType l
|
||||||
TemplateData: templateData,
|
TemplateData: templateData,
|
||||||
client: client,
|
client: client,
|
||||||
webhooks: c.webhooks,
|
webhooks: c.webhooks,
|
||||||
|
certType: certType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.step.sm/crypto/x509util"
|
||||||
|
"go.step.sm/linkedca"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
|
|
||||||
"github.com/smallstep/certificates/authority/policy"
|
"github.com/smallstep/certificates/authority/policy"
|
||||||
|
@ -445,3 +447,18 @@ func TestDefaultAuthorizeSSHRenew(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_newWebhookController(t *testing.T) {
|
||||||
|
c := &Controller{}
|
||||||
|
data := x509util.TemplateData{"foo": "bar"}
|
||||||
|
ctl := c.newWebhookController(data, linkedca.Webhook_X509)
|
||||||
|
if !reflect.DeepEqual(ctl.TemplateData, data) {
|
||||||
|
t.Error("Failed to set templateData")
|
||||||
|
}
|
||||||
|
if ctl.certType != linkedca.Webhook_X509 {
|
||||||
|
t.Error("Failed to set certType")
|
||||||
|
}
|
||||||
|
if ctl.client == nil {
|
||||||
|
t.Error("Failed to set client")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue