mocks

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: Apache-2.0 Imports: 16 Imported by: 6

Documentation

Overview

Code generated by counterfeiter. DO NOT EDIT.

Index

Constants

View Source
const DefaultNS = "did:sidetree"

DefaultNS is default namespace used in mocks

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, *txn.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.ResolutionResult, 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.ResolutionResult, 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 MockDocumentValidator added in v0.1.4

type MockDocumentValidator struct {
	IsValidPayloadErr          error
	IsValidOriginalDocumentErr error
	TransformDocumentErr       error
}

MockDocumentValidator is responsible for validating operations, original document and transforming to external document

func New added in v0.1.4

func New() *MockDocumentValidator

New creates a new mock document validator

func (*MockDocumentValidator) IsValidOriginalDocument added in v0.1.4

func (m *MockDocumentValidator) IsValidOriginalDocument(payload []byte) error

IsValidOriginalDocument mocks check that the given payload is a valid Sidetree specific document that can be accepted by the Sidetree create operation.

func (*MockDocumentValidator) IsValidPayload added in v0.1.4

func (m *MockDocumentValidator) IsValidPayload(payload []byte) error

IsValidPayload mocks check that the given payload is a valid Sidetree specific payload that can be accepted by the Sidetree update operations

func (*MockDocumentValidator) TransformDocument added in v0.1.4

func (m *MockDocumentValidator) TransformDocument(internal document.Document) (*document.ResolutionResult, error)

TransformDocument mocks transformation from internal to external document

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.AnchoredOperation, error)

Get mocks retrieving operations from the store

func (*MockOperationStore) Put

Put mocks storing operation

type MockProtocolClient

type MockProtocolClient struct {
	Protocol protocol.Protocol // current version (separated for easier testing)
	Versions []protocol.Protocol
}

MockProtocolClient mocks protocol for testing purposes.

func NewMockProtocolClient

func NewMockProtocolClient() *MockProtocolClient

NewMockProtocolClient creates mock protocol client

func (*MockProtocolClient) Current

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

Current mocks getting last protocol version

func (*MockProtocolClient) Get added in v0.1.4

func (m *MockProtocolClient) Get(transactionTime uint64) (protocol.Protocol, error)

Get mocks getting protocol version based on blockchain(transaction) time

type MockProtocolClientProvider added in v0.1.4

type MockProtocolClientProvider struct {
	ProtocolClients map[string]protocol.Client
}

MockProtocolClientProvider implements mock protocol client provider

func NewMockProtocolClientProvider added in v0.1.4

func NewMockProtocolClientProvider() *MockProtocolClientProvider

NewMockProtocolClientProvider creates new mock protocol client provider

func (*MockProtocolClientProvider) ForNamespace added in v0.1.4

func (m *MockProtocolClientProvider) ForNamespace(namespace string) (protocol.Client, error)

ForNamespace will return protocol client for that namespace

type OperationQueue added in v0.1.3

type OperationQueue struct {
	AddStub func(data *batch.OperationInfo) (uint, error)

	RemoveStub func(num uint) (uint, uint, error)

	PeekStub func(num uint) ([]*batch.OperationInfo, error)

	LenStub func() uint
	// contains filtered or unexported fields
}

func (*OperationQueue) Add added in v0.1.3

func (fake *OperationQueue) Add(data *batch.OperationInfo) (uint, error)

func (*OperationQueue) AddArgsForCall added in v0.1.3

func (fake *OperationQueue) AddArgsForCall(i int) *batch.OperationInfo

func (*OperationQueue) AddCallCount added in v0.1.3

func (fake *OperationQueue) AddCallCount() int

func (*OperationQueue) AddReturns added in v0.1.3

func (fake *OperationQueue) AddReturns(result1 uint, result2 error)

func (*OperationQueue) AddReturnsOnCall added in v0.1.3

func (fake *OperationQueue) AddReturnsOnCall(i int, result1 uint, result2 error)

func (*OperationQueue) Invocations added in v0.1.3

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

func (*OperationQueue) Len added in v0.1.3

func (fake *OperationQueue) Len() uint

func (*OperationQueue) LenCallCount added in v0.1.3

func (fake *OperationQueue) LenCallCount() int

func (*OperationQueue) LenReturns added in v0.1.3

func (fake *OperationQueue) LenReturns(result1 uint)

func (*OperationQueue) LenReturnsOnCall added in v0.1.3

func (fake *OperationQueue) LenReturnsOnCall(i int, result1 uint)

func (*OperationQueue) Peek added in v0.1.3

func (fake *OperationQueue) Peek(num uint) ([]*batch.OperationInfo, error)

func (*OperationQueue) PeekArgsForCall added in v0.1.3

func (fake *OperationQueue) PeekArgsForCall(i int) uint

func (*OperationQueue) PeekCallCount added in v0.1.3

func (fake *OperationQueue) PeekCallCount() int

func (*OperationQueue) PeekReturns added in v0.1.3

func (fake *OperationQueue) PeekReturns(result1 []*batch.OperationInfo, result2 error)

func (*OperationQueue) PeekReturnsOnCall added in v0.1.3

func (fake *OperationQueue) PeekReturnsOnCall(i int, result1 []*batch.OperationInfo, result2 error)

func (*OperationQueue) Remove added in v0.1.3

func (fake *OperationQueue) Remove(num uint) (uint, uint, error)

func (*OperationQueue) RemoveArgsForCall added in v0.1.3

func (fake *OperationQueue) RemoveArgsForCall(i int) uint

func (*OperationQueue) RemoveCallCount added in v0.1.3

func (fake *OperationQueue) RemoveCallCount() int

func (*OperationQueue) RemoveReturns added in v0.1.3

func (fake *OperationQueue) RemoveReturns(result1 uint, result2 uint, result3 error)

func (*OperationQueue) RemoveReturnsOnCall added in v0.1.3

func (fake *OperationQueue) RemoveReturnsOnCall(i int, result1 uint, result2 uint, result3 error)

Jump to

Keyboard shortcuts

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