mocks

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockBlockchainClient

type MockBlockchainClient struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MockBlockchainClient mocks blockchain client for testing purposes.

func NewMockBlockchainClient

func NewMockBlockchainClient(err error) *MockBlockchainClient

NewMockBlockchainClient creates mock client

func (*MockBlockchainClient) GetAnchors

func (m *MockBlockchainClient) GetAnchors() []string

GetAnchors returns anchors

func (*MockBlockchainClient) Read

func (m *MockBlockchainClient) Read(sinceTransactionNumber int) (bool, *observer.SidetreeTxn)

func (*MockBlockchainClient) WriteAnchor

func (m *MockBlockchainClient) WriteAnchor(anchorFileHash string) error

WriteAnchor writes the anchor file hash as a transaction to blockchain.

type MockCasClient

type MockCasClient struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MockCasClient mocks CAS for testing purposes.

func NewMockCasClient

func NewMockCasClient(err error) *MockCasClient

NewMockCasClient creates mock client

func (*MockCasClient) GetError

func (m *MockCasClient) GetError() error

GetError returns the injected error

func (*MockCasClient) Read

func (m *MockCasClient) Read(address string) ([]byte, error)

Read reads the content of the given address in CAS. returns the content of the given address.

func (*MockCasClient) SetError

func (m *MockCasClient) SetError(err error)

SetError injects an error into the mock client

func (*MockCasClient) Write

func (m *MockCasClient) Write(content []byte) (string, error)

Write writes the given content to CAS. returns the SHA256 hash in base64url encoding which represents the address of the content.

type MockDocumentHandler

type MockDocumentHandler struct {
	// contains filtered or unexported fields
}

MockDocumentHandler mocks the document handler

func NewMockDocumentHandler

func NewMockDocumentHandler() *MockDocumentHandler

NewMockDocumentHandler returns a new mock document handler

func (*MockDocumentHandler) Namespace

func (m *MockDocumentHandler) Namespace() string

Namespace returns the namespace

func (*MockDocumentHandler) ProcessOperation

func (m *MockDocumentHandler) ProcessOperation(operation batch.Operation) (document.Document, error)

ProcessOperation mocks process operation

func (*MockDocumentHandler) Protocol

func (m *MockDocumentHandler) Protocol() protocol.Client

Protocol returns the Protocol

func (*MockDocumentHandler) ResolveDocument

func (m *MockDocumentHandler) ResolveDocument(idOrDocument string) (document.Document, error)

ResolveDocument mocks resolve document

func (*MockDocumentHandler) WithError

func (m *MockDocumentHandler) WithError(err error) *MockDocumentHandler

WithError injects an error into the mock handler

func (*MockDocumentHandler) WithNamespace

func (m *MockDocumentHandler) WithNamespace(ns string) *MockDocumentHandler

WithNamespace sets the namespace

func (*MockDocumentHandler) WithProtocolClient

func (m *MockDocumentHandler) WithProtocolClient(client protocol.Client) *MockDocumentHandler

WithProtocolClient sets the protocol client

type MockOperationStore

type MockOperationStore struct {
	sync.RWMutex

	Err      error
	Validate bool
	// contains filtered or unexported fields
}

MockOperationStore mocks store for testing purposes.

func NewMockOperationStore

func NewMockOperationStore(err error) *MockOperationStore

NewMockOperationStore creates mock operations store

func (*MockOperationStore) Get

func (m *MockOperationStore) Get(uniqueSuffix string) ([]batch.Operation, error)

Get mocks retrieving operations from the store

func (*MockOperationStore) Put

Put mocks storing operation

type MockProtocolClient

type MockProtocolClient struct {
	Protocol protocol.Protocol
}

MockProtocolClient mocks protocol for testing purposes.

func NewMockProtocolClient

func NewMockProtocolClient() *MockProtocolClient

NewMockProtocolClient creates mocks protocol client

func (*MockProtocolClient) Current

func (m *MockProtocolClient) Current() protocol.Protocol

Current mocks getting last protocol version

Jump to

Keyboard shortcuts

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