github.com/blend/go-sdk@v1.20240719.1/certutil/create_self_cert_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2024 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package certutil
     9  
    10  import (
    11  	"testing"
    12  	"time"
    13  
    14  	"github.com/blend/go-sdk/assert"
    15  )
    16  
    17  func TestCreateSelfServerCert(t *testing.T) {
    18  	t.Parallel()
    19  
    20  	assert := assert.New(t)
    21  
    22  	notAfter := time.Date(2016, 02, 03, 12, 0, 0, 0, time.UTC)
    23  	cert, err := CreateSelfServerCert("foo.bar.com", OptSubjectOrganization("the goods"), OptNotAfter(notAfter))
    24  	assert.Nil(err)
    25  	assert.NotNil(cert)
    26  	assert.Equal([]string{"the goods"}, cert.Certificates[0].Subject.Organization)
    27  	assert.Equal("foo.bar.com", cert.Certificates[0].Subject.CommonName)
    28  	assert.Equal(notAfter, cert.Certificates[0].NotAfter)
    29  }