github.com/true-sqn/fabric@v2.1.1+incompatible/bccsp/sw/dummyks_test.go (about) 1 /* 2 Copyright IBM Corp. 2017 All Rights Reserved. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 package sw 17 18 import ( 19 "testing" 20 21 "github.com/hyperledger/fabric/bccsp/mocks" 22 "github.com/stretchr/testify/assert" 23 ) 24 25 func TestNewDummyKeyStore(t *testing.T) { 26 t.Parallel() 27 28 ks := NewDummyKeyStore() 29 assert.NotNil(t, ks) 30 } 31 32 func TestDummyKeyStore_GetKey(t *testing.T) { 33 t.Parallel() 34 35 ks := NewDummyKeyStore() 36 _, err := ks.GetKey([]byte{0, 1, 2, 3, 4}) 37 assert.Error(t, err) 38 } 39 40 func TestDummyKeyStore_ReadOnly(t *testing.T) { 41 t.Parallel() 42 43 ks := NewDummyKeyStore() 44 assert.True(t, ks.ReadOnly()) 45 } 46 47 func TestDummyKeyStore_StoreKey(t *testing.T) { 48 t.Parallel() 49 50 ks := NewDummyKeyStore() 51 err := ks.StoreKey(&mocks.MockKey{}) 52 assert.Error(t, err) 53 }