mocks

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockDCASClient

type MockDCASClient struct {
	*MockOffLedgerClient
}

MockDCASClient mocks DCAS for testing purposes.

func NewMockDCASClient

func NewMockDCASClient() *MockDCASClient

NewMockDCASClient creates mock DCAS client

func (*MockDCASClient) Put

func (m *MockDCASClient) Put(ns, coll string, content []byte) (string, error)

Put stores content in mock content addressable storage

type MockOffLedgerClient

type MockOffLedgerClient struct {
	sync.RWMutex

	PutErr error
	GetErr error
	// contains filtered or unexported fields
}

MockOffLedgerClient mocks the off-ledger client

func NewMockOffLedgerClient

func NewMockOffLedgerClient() *MockOffLedgerClient

NewMockOffLedgerClient creates a mock off-ledger client

func (*MockOffLedgerClient) Get

func (m *MockOffLedgerClient) Get(ns, coll, key string) ([]byte, error)

Get retrieves the value from mock content addressable storage

func (*MockOffLedgerClient) GetMap

func (m *MockOffLedgerClient) GetMap(ns, coll string) (map[string][]byte, error)

GetMap retrieves all values for namespace and collection

func (*MockOffLedgerClient) Put

func (m *MockOffLedgerClient) Put(ns, coll, key string, content []byte) error

Put stores content in the off-ledger store

func (*MockOffLedgerClient) WithGetError

func (m *MockOffLedgerClient) WithGetError(err error) *MockOffLedgerClient

WithGetError injects an error when a call is made to get a value

func (*MockOffLedgerClient) WithGetErrorForKey

func (m *MockOffLedgerClient) WithGetErrorForKey(ns, coll, key string, err error) *MockOffLedgerClient

WithGetErrorForKey injects an error when a call is made to get a value for the given namespace, collection, and key

func (*MockOffLedgerClient) WithPutError

func (m *MockOffLedgerClient) WithPutError(err error) *MockOffLedgerClient

WithPutError injects an error when a call is made to put a value

func (*MockOffLedgerClient) WithPutErrorForKey

func (m *MockOffLedgerClient) WithPutErrorForKey(ns, coll, key string, err error) *MockOffLedgerClient

WithPutErrorForKey injects an error when a call is made to put a value for the given namespace, collection, and key

Jump to

Keyboard shortcuts

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