github.com/s7techlab/cckit@v0.10.5/identity/cert_test.go (about)

     1  package identity_test
     2  
     3  import (
     4  	"github.com/s7techlab/cckit/identity"
     5  	"github.com/s7techlab/cckit/identity/testdata"
     6  
     7  	. "github.com/onsi/ginkgo"
     8  	. "github.com/onsi/gomega"
     9  
    10  	"testing"
    11  )
    12  
    13  func TestIdentity(t *testing.T) {
    14  	RegisterFailHandler(Fail)
    15  	RunSpecs(t, "Router suite")
    16  }
    17  
    18  var (
    19  	certA = testdata.Certificates[0].MustCertBytes()
    20  	certB = testdata.Certificates[1].MustCertBytes()
    21  )
    22  
    23  var _ = Describe(`Cert`, func() {
    24  
    25  	BeforeSuite(func() {
    26  
    27  	})
    28  
    29  	It(`Allow to compare certificate subject `, func() {
    30  
    31  		certEq, err := identity.CertSubjEqual(certA, certB)
    32  
    33  		Expect(certEq).To(BeFalse())
    34  		Expect(err).NotTo(HaveOccurred())
    35  
    36  		certEq, err = identity.CertSubjEqual(certA, certA)
    37  
    38  		Expect(certEq).To(BeTrue())
    39  		Expect(err).NotTo(HaveOccurred())
    40  	})
    41  
    42  })