github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+incompatible/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/hyperledger/fabric/bccsp/sw"
    13  	"github.com/hyperledger/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  }