github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/bccsp/factory/nopkcs11_test.go (about)

     1  //go:build !pkcs11
     2  // +build !pkcs11
     3  
     4  /*
     5  Copyright hechain. All Rights Reserved.
     6  
     7  SPDX-License-Identifier: Apache-2.0
     8  */
     9  
    10  package factory
    11  
    12  import (
    13  	"testing"
    14  
    15  	"github.com/stretchr/testify/require"
    16  )
    17  
    18  func TestInitFactories(t *testing.T) {
    19  	err := initFactories(&FactoryOpts{
    20  		Default: "SW",
    21  		SW:      &SwOpts{},
    22  	})
    23  	require.EqualError(t, err, "Failed initializing BCCSP: Could not initialize BCCSP SW [Failed initializing configuration at [0,]: Hash Family not supported []]")
    24  
    25  	err = initFactories(&FactoryOpts{
    26  		Default: "PKCS11",
    27  	})
    28  	require.EqualError(t, err, "Could not find default `PKCS11` BCCSP")
    29  }