github.com/kaituanwang/hyperledger@v2.0.1+incompatible/core/aclmgmt/mocks/mocks.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package mocks
     8  
     9  import (
    10  	"testing"
    11  
    12  	"github.com/hyperledger/fabric-protos-go/common"
    13  	"github.com/hyperledger/fabric/core/ledger"
    14  	"github.com/stretchr/testify/mock"
    15  )
    16  
    17  type MockACLProvider struct {
    18  	//create a mock object that can be reset after
    19  	//registering a MockACLProvider with aclmgmt
    20  	mock *mock.Mock
    21  }
    22  
    23  //clear the mock so we can start afresh
    24  func (m *MockACLProvider) Reset() {
    25  	m.mock = &mock.Mock{}
    26  }
    27  
    28  func (m *MockACLProvider) CheckACL(resName string, channelID string, idinfo interface{}) error {
    29  	args := m.mock.Called(resName, channelID, idinfo)
    30  	return args.Error(0)
    31  }
    32  
    33  func (m *MockACLProvider) GenerateSimulationResults(txEnvelop *common.Envelope, simulator ledger.TxSimulator, initializingLedger bool) error {
    34  	return nil
    35  }
    36  
    37  //On overrider the mock method for convenience
    38  func (m *MockACLProvider) On(methodName string, arguments ...interface{}) *mock.Call {
    39  	return m.mock.On(methodName, arguments...)
    40  }
    41  
    42  //AssertExpectations overrider the mock method for convenience
    43  func (m *MockACLProvider) AssertExpectations(t *testing.T) {
    44  	m.mock.AssertExpectations(t)
    45  }