mocks

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DCASStubWrapperFactory added in v0.1.5

type DCASStubWrapperFactory struct {
	CreateDCASClientStubWrapperStub func(coll string, stub shim.ChaincodeStubInterface) (dcasclient.DCAS, error)
	// contains filtered or unexported fields
}

func (*DCASStubWrapperFactory) CreateDCASClientStubWrapper added in v0.1.5

func (fake *DCASStubWrapperFactory) CreateDCASClientStubWrapper(coll string, stub shim.ChaincodeStubInterface) (dcasclient.DCAS, error)

func (*DCASStubWrapperFactory) CreateDCASClientStubWrapperArgsForCall added in v0.1.5

func (fake *DCASStubWrapperFactory) CreateDCASClientStubWrapperArgsForCall(i int) (string, shim.ChaincodeStubInterface)

func (*DCASStubWrapperFactory) CreateDCASClientStubWrapperCallCount added in v0.1.5

func (fake *DCASStubWrapperFactory) CreateDCASClientStubWrapperCallCount() int

func (*DCASStubWrapperFactory) CreateDCASClientStubWrapperReturns added in v0.1.5

func (fake *DCASStubWrapperFactory) CreateDCASClientStubWrapperReturns(result1 dcasclient.DCAS, result2 error)

func (*DCASStubWrapperFactory) CreateDCASClientStubWrapperReturnsOnCall added in v0.1.5

func (fake *DCASStubWrapperFactory) CreateDCASClientStubWrapperReturnsOnCall(i int, result1 dcasclient.DCAS, result2 error)

func (*DCASStubWrapperFactory) Invocations added in v0.1.5

func (fake *DCASStubWrapperFactory) Invocations() map[string][][]interface{}

type MockStateQueryIterator

type MockStateQueryIterator struct {
	Closed  bool
	Stub    *MockStub
	Query   string
	Current *list.Element
}

MockStateQueryIterator is a mock implementation of the state query iterator

func NewMockStateQueryIterator

func NewMockStateQueryIterator(stub *MockStub, collection, query string) *MockStateQueryIterator

NewMockStateQueryIterator returns a mock state iterator

func (*MockStateQueryIterator) Close

func (iter *MockStateQueryIterator) Close() error

Close closes the range query iterator. This should be called when done reading from the iterator to free up resources.

func (*MockStateQueryIterator) HasNext

func (iter *MockStateQueryIterator) HasNext() bool

HasNext returns true if the range query iterator contains additional keys and values.

func (*MockStateQueryIterator) Next

func (iter *MockStateQueryIterator) Next() (*queryresult.KV, error)

Next returns the next key and value in the range query iterator.

type MockStub

type MockStub struct {
	shimtest.MockStub

	// registered list of other MockStub chaincodes that can be called from this MockStub
	Invokables map[string]*MockStub
	// Transient map
	Transient map[string][]byte

	//PvtState contains private state
	PvtState map[string]stateMap

	// Keys stores the list of mapped values in lexical order
	Keys map[string]*list.List

	// Errors used for testing
	GetPrivateErr      error
	PutPrivateErr      error
	GetPrivateQueryErr error
	// contains filtered or unexported fields
}

MockStub is an implementation of ChaincodeStubInterface for unit testing chaincode. Use this instead of ChaincodeStub in your chaincode's unit test calls to Init or Invoke.

func NewMockStub

func NewMockStub(name string, cc shim.Chaincode) *MockStub

NewMockStub initializes state map, private state, transients, invokables etc.

func (*MockStub) DelState

func (stub *MockStub) DelState(key string) error

DelState removes the specified `key` and its value from the ledger.

func (*MockStub) GetArgs

func (stub *MockStub) GetArgs() [][]byte

GetArgs returns args

func (*MockStub) GetPrivateData

func (stub *MockStub) GetPrivateData(collection string, key string) ([]byte, error)

GetPrivateData implements get private data

func (*MockStub) GetPrivateDataQueryResult

func (stub *MockStub) GetPrivateDataQueryResult(collection, query string) (shim.StateQueryIteratorInterface, error)

GetPrivateDataQueryResult mocks rich query

func (*MockStub) GetState

func (stub *MockStub) GetState(key string) ([]byte, error)

GetState retrieves the value for a given key from the ledger

func (*MockStub) GetTransient

func (stub *MockStub) GetTransient() (map[string][]byte, error)

GetTransient returns transient map

func (*MockStub) InvokeChaincode

func (stub *MockStub) InvokeChaincode(chaincodeName string, args [][]byte, channel string) pb.Response

InvokeChaincode calls a peered chaincode. E.g. stub1.InvokeChaincode("stub2Hash", funcArgs, channel) Before calling this make sure to create another MockStub stub2, call stub2.MockInit(uuid, func, args) and register it with stub1 by calling stub1.MockPeerChaincode("stub2Hash", stub2)

func (*MockStub) MockInit

func (stub *MockStub) MockInit(uuid string, args [][]byte) pb.Response

MockInit calls init chaincode

func (*MockStub) MockInvoke

func (stub *MockStub) MockInvoke(uuid string, args [][]byte) pb.Response

MockInvoke invokes chaincode

func (*MockStub) PutPrivateData

func (stub *MockStub) PutPrivateData(collection string, key string, value []byte) error

PutPrivateData implements put private data

func (*MockStub) PutState

func (stub *MockStub) PutState(key string, value []byte) error

PutState writes the specified `value` and `key` into the ledger.

type ProtocolClientChannelProvider added in v0.1.5

type ProtocolClientChannelProvider struct {
	ProtocolClientProviderForChannelStub func(channelID string) (ctxcommon.ProtocolClientProvider, error)
	// contains filtered or unexported fields
}

func (*ProtocolClientChannelProvider) Invocations added in v0.1.5

func (fake *ProtocolClientChannelProvider) Invocations() map[string][][]interface{}

func (*ProtocolClientChannelProvider) ProtocolClientProviderForChannel added in v0.1.5

func (fake *ProtocolClientChannelProvider) ProtocolClientProviderForChannel(channelID string) (ctxcommon.ProtocolClientProvider, error)

func (*ProtocolClientChannelProvider) ProtocolClientProviderForChannelArgsForCall added in v0.1.5

func (fake *ProtocolClientChannelProvider) ProtocolClientProviderForChannelArgsForCall(i int) string

func (*ProtocolClientChannelProvider) ProtocolClientProviderForChannelCallCount added in v0.1.5

func (fake *ProtocolClientChannelProvider) ProtocolClientProviderForChannelCallCount() int

func (*ProtocolClientChannelProvider) ProtocolClientProviderForChannelReturns added in v0.1.5

func (fake *ProtocolClientChannelProvider) ProtocolClientProviderForChannelReturns(result1 ctxcommon.ProtocolClientProvider, result2 error)

func (*ProtocolClientChannelProvider) ProtocolClientProviderForChannelReturnsOnCall added in v0.1.5

func (fake *ProtocolClientChannelProvider) ProtocolClientProviderForChannelReturnsOnCall(i int, result1 ctxcommon.ProtocolClientProvider, result2 error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL