github.com/osdi23p228/fabric@v0.0.0-20221218062954-77808885f5db/common/channelconfig/consortium_test.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  package channelconfig
     7  
     8  import (
     9  	"testing"
    10  
    11  	cb "github.com/hyperledger/fabric-protos-go/common"
    12  	"github.com/osdi23p228/fabric/bccsp/sw"
    13  	"github.com/osdi23p228/fabric/msp"
    14  	"github.com/stretchr/testify/assert"
    15  )
    16  
    17  func TestConsortiumConfig(t *testing.T) {
    18  	cryptoProvider, err := sw.NewDefaultSecurityLevelWithKeystore(sw.NewDummyKeyStore())
    19  	assert.NoError(t, err)
    20  	cc, err := NewConsortiumConfig(&cb.ConfigGroup{}, NewMSPConfigHandler(msp.MSPv1_0, cryptoProvider))
    21  	assert.NoError(t, err)
    22  	orgs := cc.Organizations()
    23  	assert.Equal(t, 0, len(orgs))
    24  
    25  	policy := cc.ChannelCreationPolicy()
    26  	assert.EqualValues(t, cb.Policy_UNKNOWN, policy.Type, "Expected policy type to be UNKNOWN")
    27  }