diff options
Diffstat (limited to 'certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller_test.go')
-rw-r--r-- | certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller_test.go b/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller_test.go new file mode 100644 index 00000000..36cfbc48 --- /dev/null +++ b/certServiceK8sExternalProvider/src/cmpv2controller/certificate_request_controller_test.go @@ -0,0 +1,35 @@ +package cmpv2controller + +import ( + cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1" + "testing" +) + +func TestIsCMPv2CertificateRequest_notCMPv2Request(t *testing.T) { + request := new(cmapi.CertificateRequest) + if isCMPv2CertificateRequest(request) { + t.Logf("CPMv2 request [NOK]") + t.FailNow() + } + + request.Spec.IssuerRef.Group = "certmanager.onap.org" + request.Spec.IssuerRef.Kind = "CertificateRequest" + if isCMPv2CertificateRequest(request) { + t.Logf("CPMv2 request [NOK]") + t.FailNow() + } +} + +func TestIsCMPv2CertificateRequest_CMPvRequest(t *testing.T) { + request := new(cmapi.CertificateRequest) + request.Spec.IssuerRef.Group = "certmanager.onap.org" + request.Spec.IssuerRef.Kind = "CMPv2Issuer" + + if isCMPv2CertificateRequest(request) { + t.Logf("CPMv2 request [OK]") + } else { + t.Logf("Not a CPMv2 request [NOK]") + t.FailNow() + } +} + |