|
| 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 | + ks := NewDummyKeyStore() |
| 27 | + assert.NotNil(t, ks) |
| 28 | +} |
| 29 | + |
| 30 | +func TestDummyKeyStore_GetKey(t *testing.T) { |
| 31 | + ks := NewDummyKeyStore() |
| 32 | + _, err := ks.GetKey([]byte{0, 1, 2, 3, 4}) |
| 33 | + assert.Error(t, err) |
| 34 | +} |
| 35 | + |
| 36 | +func TestDummyKeyStore_ReadOnly(t *testing.T) { |
| 37 | + ks := NewDummyKeyStore() |
| 38 | + assert.True(t, ks.ReadOnly()) |
| 39 | +} |
| 40 | + |
| 41 | +func TestDummyKeyStore_StoreKey(t *testing.T) { |
| 42 | + ks := NewDummyKeyStore() |
| 43 | + err := ks.StoreKey(&mocks.MockKey{}) |
| 44 | + assert.Error(t, err) |
| 45 | +} |
0 commit comments