go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/certutil/create_client_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2023 - Present. Will Charczuk. All rights reserved.
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository.
     5  
     6  */
     7  
     8  package certutil
     9  
    10  import (
    11  	"testing"
    12  
    13  	. "go.charczuk.com/sdk/assert"
    14  	"go.charczuk.com/sdk/uuid"
    15  )
    16  
    17  func TestCreateClient(t *testing.T) {
    18  	t.Parallel()
    19  
    20  	caKeyPair := KeyPair{
    21  		Cert: string(caCertLiteral),
    22  		Key:  string(caKeyLiteral),
    23  	}
    24  	ca, err := NewCertBundle(caKeyPair)
    25  	ItsNil(t, err)
    26  
    27  	uid := uuid.V4().String()
    28  	client, err := CreateClient(uid, ca)
    29  	ItsNil(t, err)
    30  	ItsLen(t, client.Certificates, 2)
    31  	ItsLen(t, client.CertificateDERs, 2)
    32  }