mocks

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Code generated by counterfeiter. DO NOT EDIT.

Code generated by counterfeiter. DO NOT EDIT.

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 Activities

type Activities []*vocab.ActivityType

Activities contains a slice of ActivityType.

func (Activities) QueryByType

func (a Activities) QueryByType(types ...vocab.Type) Activities

QueryByType returns the activities that match the given types.

type ActivityHandler

type ActivityHandler struct {
	StartStub func()

	StopStub func()

	StateStub func() lifecycle.State

	HandleActivityStub func(activity *vocab.ActivityType) error

	SubscribeStub func() <-chan *vocab.ActivityType
	// contains filtered or unexported fields
}

func (*ActivityHandler) HandleActivity

func (fake *ActivityHandler) HandleActivity(activity *vocab.ActivityType) error

func (*ActivityHandler) HandleActivityArgsForCall

func (fake *ActivityHandler) HandleActivityArgsForCall(i int) *vocab.ActivityType

func (*ActivityHandler) HandleActivityCallCount

func (fake *ActivityHandler) HandleActivityCallCount() int

func (*ActivityHandler) HandleActivityReturns

func (fake *ActivityHandler) HandleActivityReturns(result1 error)

func (*ActivityHandler) HandleActivityReturnsOnCall

func (fake *ActivityHandler) HandleActivityReturnsOnCall(i int, result1 error)

func (*ActivityHandler) Invocations

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

func (*ActivityHandler) Start

func (fake *ActivityHandler) Start()

func (*ActivityHandler) StartCallCount

func (fake *ActivityHandler) StartCallCount() int

func (*ActivityHandler) State

func (fake *ActivityHandler) State() lifecycle.State

func (*ActivityHandler) StateCallCount

func (fake *ActivityHandler) StateCallCount() int

func (*ActivityHandler) StateReturns

func (fake *ActivityHandler) StateReturns(result1 lifecycle.State)

func (*ActivityHandler) StateReturnsOnCall

func (fake *ActivityHandler) StateReturnsOnCall(i int, result1 lifecycle.State)

func (*ActivityHandler) Stop

func (fake *ActivityHandler) Stop()

func (*ActivityHandler) StopCallCount

func (fake *ActivityHandler) StopCallCount() int

func (*ActivityHandler) Subscribe

func (fake *ActivityHandler) Subscribe() <-chan *vocab.ActivityType

func (*ActivityHandler) SubscribeCallCount

func (fake *ActivityHandler) SubscribeCallCount() int

func (*ActivityHandler) SubscribeReturns

func (fake *ActivityHandler) SubscribeReturns(result1 <-chan *vocab.ActivityType)

func (*ActivityHandler) SubscribeReturnsOnCall

func (fake *ActivityHandler) SubscribeReturnsOnCall(i int, result1 <-chan *vocab.ActivityType)

type ActivityStore

type ActivityStore struct {
	AddActivityStub func(*vocab.ActivityType) error

	AddReferenceStub func(spi.ReferenceType, *url.URL, *url.URL) error

	DeleteReferenceStub func(spi.ReferenceType, *url.URL, *url.URL) error

	GetActivityStub func(*url.URL) (*vocab.ActivityType, error)

	GetActorStub func(*url.URL) (*vocab.ActorType, error)

	PutActorStub func(*vocab.ActorType) error

	QueryActivitiesStub func(*spi.Criteria, ...spi.QueryOpt) (spi.ActivityIterator, error)

	QueryReferencesStub func(spi.ReferenceType, *spi.Criteria, ...spi.QueryOpt) (spi.ReferenceIterator, error)
	// contains filtered or unexported fields
}

func (*ActivityStore) AddActivity

func (fake *ActivityStore) AddActivity(arg1 *vocab.ActivityType) error

func (*ActivityStore) AddActivityArgsForCall

func (fake *ActivityStore) AddActivityArgsForCall(i int) *vocab.ActivityType

func (*ActivityStore) AddActivityCallCount

func (fake *ActivityStore) AddActivityCallCount() int

func (*ActivityStore) AddActivityCalls added in v0.1.2

func (fake *ActivityStore) AddActivityCalls(stub func(*vocab.ActivityType) error)

func (*ActivityStore) AddActivityReturns

func (fake *ActivityStore) AddActivityReturns(result1 error)

func (*ActivityStore) AddActivityReturnsOnCall

func (fake *ActivityStore) AddActivityReturnsOnCall(i int, result1 error)

func (*ActivityStore) AddReference

func (fake *ActivityStore) AddReference(arg1 spi.ReferenceType, arg2 *url.URL, arg3 *url.URL) error

func (*ActivityStore) AddReferenceArgsForCall

func (fake *ActivityStore) AddReferenceArgsForCall(i int) (spi.ReferenceType, *url.URL, *url.URL)

func (*ActivityStore) AddReferenceCallCount

func (fake *ActivityStore) AddReferenceCallCount() int

func (*ActivityStore) AddReferenceCalls added in v0.1.2

func (fake *ActivityStore) AddReferenceCalls(stub func(spi.ReferenceType, *url.URL, *url.URL) error)

func (*ActivityStore) AddReferenceReturns

func (fake *ActivityStore) AddReferenceReturns(result1 error)

func (*ActivityStore) AddReferenceReturnsOnCall

func (fake *ActivityStore) AddReferenceReturnsOnCall(i int, result1 error)

func (*ActivityStore) DeleteReference

func (fake *ActivityStore) DeleteReference(arg1 spi.ReferenceType, arg2 *url.URL, arg3 *url.URL) error

func (*ActivityStore) DeleteReferenceArgsForCall

func (fake *ActivityStore) DeleteReferenceArgsForCall(i int) (spi.ReferenceType, *url.URL, *url.URL)

func (*ActivityStore) DeleteReferenceCallCount

func (fake *ActivityStore) DeleteReferenceCallCount() int

func (*ActivityStore) DeleteReferenceCalls added in v0.1.2

func (fake *ActivityStore) DeleteReferenceCalls(stub func(spi.ReferenceType, *url.URL, *url.URL) error)

func (*ActivityStore) DeleteReferenceReturns

func (fake *ActivityStore) DeleteReferenceReturns(result1 error)

func (*ActivityStore) DeleteReferenceReturnsOnCall

func (fake *ActivityStore) DeleteReferenceReturnsOnCall(i int, result1 error)

func (*ActivityStore) GetActivity

func (fake *ActivityStore) GetActivity(arg1 *url.URL) (*vocab.ActivityType, error)

func (*ActivityStore) GetActivityArgsForCall

func (fake *ActivityStore) GetActivityArgsForCall(i int) *url.URL

func (*ActivityStore) GetActivityCallCount

func (fake *ActivityStore) GetActivityCallCount() int

func (*ActivityStore) GetActivityCalls added in v0.1.2

func (fake *ActivityStore) GetActivityCalls(stub func(*url.URL) (*vocab.ActivityType, error))

func (*ActivityStore) GetActivityReturns

func (fake *ActivityStore) GetActivityReturns(result1 *vocab.ActivityType, result2 error)

func (*ActivityStore) GetActivityReturnsOnCall

func (fake *ActivityStore) GetActivityReturnsOnCall(i int, result1 *vocab.ActivityType, result2 error)

func (*ActivityStore) GetActor

func (fake *ActivityStore) GetActor(arg1 *url.URL) (*vocab.ActorType, error)

func (*ActivityStore) GetActorArgsForCall

func (fake *ActivityStore) GetActorArgsForCall(i int) *url.URL

func (*ActivityStore) GetActorCallCount

func (fake *ActivityStore) GetActorCallCount() int

func (*ActivityStore) GetActorCalls added in v0.1.2

func (fake *ActivityStore) GetActorCalls(stub func(*url.URL) (*vocab.ActorType, error))

func (*ActivityStore) GetActorReturns

func (fake *ActivityStore) GetActorReturns(result1 *vocab.ActorType, result2 error)

func (*ActivityStore) GetActorReturnsOnCall

func (fake *ActivityStore) GetActorReturnsOnCall(i int, result1 *vocab.ActorType, result2 error)

func (*ActivityStore) Invocations

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

func (*ActivityStore) PutActor

func (fake *ActivityStore) PutActor(arg1 *vocab.ActorType) error

func (*ActivityStore) PutActorArgsForCall

func (fake *ActivityStore) PutActorArgsForCall(i int) *vocab.ActorType

func (*ActivityStore) PutActorCallCount

func (fake *ActivityStore) PutActorCallCount() int

func (*ActivityStore) PutActorCalls added in v0.1.2

func (fake *ActivityStore) PutActorCalls(stub func(*vocab.ActorType) error)

func (*ActivityStore) PutActorReturns

func (fake *ActivityStore) PutActorReturns(result1 error)

func (*ActivityStore) PutActorReturnsOnCall

func (fake *ActivityStore) PutActorReturnsOnCall(i int, result1 error)

func (*ActivityStore) QueryActivities

func (fake *ActivityStore) QueryActivities(arg1 *spi.Criteria, arg2 ...spi.QueryOpt) (spi.ActivityIterator, error)

func (*ActivityStore) QueryActivitiesArgsForCall

func (fake *ActivityStore) QueryActivitiesArgsForCall(i int) (*spi.Criteria, []spi.QueryOpt)

func (*ActivityStore) QueryActivitiesCallCount

func (fake *ActivityStore) QueryActivitiesCallCount() int

func (*ActivityStore) QueryActivitiesCalls added in v0.1.2

func (fake *ActivityStore) QueryActivitiesCalls(stub func(*spi.Criteria, ...spi.QueryOpt) (spi.ActivityIterator, error))

func (*ActivityStore) QueryActivitiesReturns

func (fake *ActivityStore) QueryActivitiesReturns(result1 spi.ActivityIterator, result2 error)

func (*ActivityStore) QueryActivitiesReturnsOnCall

func (fake *ActivityStore) QueryActivitiesReturnsOnCall(i int, result1 spi.ActivityIterator, result2 error)

func (*ActivityStore) QueryReferences

func (fake *ActivityStore) QueryReferences(arg1 spi.ReferenceType, arg2 *spi.Criteria, arg3 ...spi.QueryOpt) (spi.ReferenceIterator, error)

func (*ActivityStore) QueryReferencesArgsForCall

func (fake *ActivityStore) QueryReferencesArgsForCall(i int) (spi.ReferenceType, *spi.Criteria, []spi.QueryOpt)

func (*ActivityStore) QueryReferencesCallCount

func (fake *ActivityStore) QueryReferencesCallCount() int

func (*ActivityStore) QueryReferencesCalls added in v0.1.2

func (fake *ActivityStore) QueryReferencesCalls(stub func(spi.ReferenceType, *spi.Criteria, ...spi.QueryOpt) (spi.ReferenceIterator, error))

func (*ActivityStore) QueryReferencesReturns

func (fake *ActivityStore) QueryReferencesReturns(result1 spi.ReferenceIterator, result2 error)

func (*ActivityStore) QueryReferencesReturnsOnCall

func (fake *ActivityStore) QueryReferencesReturnsOnCall(i int, result1 spi.ReferenceIterator, result2 error)

type ActorAuth

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

ActorAuth implements a mock actor authorization handler.

func NewActorAuth

func NewActorAuth() *ActorAuth

NewActorAuth returns a mock actor authorization.

func (*ActorAuth) AuthorizeActor

func (m *ActorAuth) AuthorizeActor(follower *vocab.ActorType) (bool, error)

AuthorizeActor is a mock implementation that returns the injected values.

func (*ActorAuth) WithAccept

func (m *ActorAuth) WithAccept() *ActorAuth

WithAccept ensures that the request is accepted.

func (*ActorAuth) WithError

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

WithError injects an error into the handler.

func (*ActorAuth) WithReject

func (m *ActorAuth) WithReject() *ActorAuth

WithReject ensures that the request is rejected.

type ActorRetriever

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

ActorRetriever is a mock retriever for actors and public keys of actors.

func NewActorRetriever

func NewActorRetriever() *ActorRetriever

NewActorRetriever returns a mock actor retriever.

func (*ActorRetriever) GetActor

func (m *ActorRetriever) GetActor(actorIRI *url.URL) (*vocab.ActorType, error)

GetActor returns the actor for the given IRI.

func (*ActorRetriever) GetPublicKey

func (m *ActorRetriever) GetPublicKey(keyIRI *url.URL) (*vocab.PublicKeyType, error)

GetPublicKey returns the public key for the given IRI.

func (*ActorRetriever) GetReferences added in v0.1.2

func (m *ActorRetriever) GetReferences(iri *url.URL) (client.ReferenceIterator, error)

GetReferences simply returns an iterator that contains the IRI passed as an arg.

func (*ActorRetriever) WithActor

func (m *ActorRetriever) WithActor(actor *vocab.ActorType) *ActorRetriever

WithActor adds the given actor to the map of actors which is used by GetActor.

func (*ActorRetriever) WithError added in v0.1.2

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

WithError sets an error to be returned when any function is invoked on this struct.

func (*ActorRetriever) WithPublicKey

func (m *ActorRetriever) WithPublicKey(key *vocab.PublicKeyType) *ActorRetriever

WithPublicKey adds the given public key to the map of keys which is used by GetPublicKey.

type AnchorCredentialHandler

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

AnchorCredentialHandler is a mock anchor credential handler.

func NewAnchorCredentialHandler

func NewAnchorCredentialHandler() *AnchorCredentialHandler

NewAnchorCredentialHandler returns a mock anchor credential handler.

func (*AnchorCredentialHandler) AnchorCred

func (m *AnchorCredentialHandler) AnchorCred(id string) ([]byte, bool)

AnchorCred returns the anchor credential by ID or nil if it doesn't exist.

func (*AnchorCredentialHandler) HandleAnchorCredential

func (m *AnchorCredentialHandler) HandleAnchorCredential(actor, id *url.URL, cid string, anchorCred []byte) error

HandleAnchorCredential stores the anchor credential or returns an error if it was set.

func (*AnchorCredentialHandler) WithError

WithError injects an error into the mock handler.

type AnchorEventAcknowledgementHandler added in v0.1.3

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

AnchorEventAcknowledgementHandler implements a mock anchor event acknowledgement handler.

func NewAnchorEventAcknowledgementHandler added in v0.1.3

func NewAnchorEventAcknowledgementHandler() *AnchorEventAcknowledgementHandler

NewAnchorEventAcknowledgementHandler returns a mock handler.

func (*AnchorEventAcknowledgementHandler) AnchorEventAcknowledged added in v0.1.3

func (m *AnchorEventAcknowledgementHandler) AnchorEventAcknowledged(actor, anchorRef *url.URL,
	additionalAnchorRefs []*url.URL) error

AnchorEventAcknowledged handles the acknowledgement of a successful anchor event processed from an Orb server.

func (*AnchorEventAcknowledgementHandler) Anchors added in v0.1.3

func (m *AnchorEventAcknowledgementHandler) Anchors() []*url.URL

Anchors returns the anchors that were added to this mock.

func (*AnchorEventAcknowledgementHandler) WithError added in v0.1.3

WithError injects an error.

type MockPubSub

type MockPubSub struct {
	*lifecycle.Lifecycle

	Err     error
	MsgChan map[string]chan *message.Message

	Timeout time.Duration
	// contains filtered or unexported fields
}

MockPubSub implements a mock publisher-subscriber.

func NewPubSub

func NewPubSub() *MockPubSub

NewPubSub returns a mock publisher-subscriber.

func (*MockPubSub) Close

func (m *MockPubSub) Close() error

Close closes the subscriber channels.

func (*MockPubSub) Publish

func (m *MockPubSub) Publish(topic string, messages ...*message.Message) error

Publish publishes the messages to the subscribers.

func (*MockPubSub) Subscribe

func (m *MockPubSub) Subscribe(_ context.Context, topic string) (<-chan *message.Message, error)

Subscribe subscribes to the given topic.

func (*MockPubSub) WithError

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

WithError injects an error into the mock publisher-subscriber.

type Outbox

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

Outbox implements a mock Outbox.

func NewOutbox

func NewOutbox() *Outbox

NewOutbox returns a mock outbox.

func (*Outbox) Activities

func (m *Outbox) Activities() Activities

Activities returns the activities that were posted to the outbox.

func (*Outbox) Post

func (m *Outbox) Post(activity *vocab.ActivityType) (*url.URL, error)

Post post an activity to the outbox. The activity is simply stored so that it may be retrieved by the Activies function.

func (*Outbox) Start

func (m *Outbox) Start()

Start does nothing.

func (*Outbox) State

func (m *Outbox) State() lifecycle.State

State always returns StateStarted.

func (*Outbox) Stop

func (m *Outbox) Stop()

Stop does nothing.

func (*Outbox) WithActivityID

func (m *Outbox) WithActivityID(id *url.URL) *Outbox

WithActivityID sets the ID of the posted activity.

func (*Outbox) WithError

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

WithError injects an error into the mock outbox.

type ProofHandler

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

ProofHandler implements a mock proof handler.

func NewProofHandler

func NewProofHandler() *ProofHandler

NewProofHandler returns a mock proof handler.

func (*ProofHandler) HandleProof

func (m *ProofHandler) HandleProof(witness *url.URL, anchorCredID string, endTime time.Time, proof []byte) error

HandleProof store the proof and returns any injected error.

func (*ProofHandler) Proof

func (m *ProofHandler) Proof(objID string) []byte

Proof returns the stored proof for the givin ID.

func (*ProofHandler) WithError

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

WithError injects an error.

type ReferenceIterator added in v0.1.2

type ReferenceIterator struct {
	NextStub func() (*url.URL, error)

	TotalItemsStub func() int
	// contains filtered or unexported fields
}

func (*ReferenceIterator) Invocations added in v0.1.2

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

func (*ReferenceIterator) Next added in v0.1.2

func (fake *ReferenceIterator) Next() (*url.URL, error)

func (*ReferenceIterator) NextCallCount added in v0.1.2

func (fake *ReferenceIterator) NextCallCount() int

func (*ReferenceIterator) NextReturns added in v0.1.2

func (fake *ReferenceIterator) NextReturns(result1 *url.URL, result2 error)

func (*ReferenceIterator) NextReturnsOnCall added in v0.1.2

func (fake *ReferenceIterator) NextReturnsOnCall(i int, result1 *url.URL, result2 error)

func (*ReferenceIterator) TotalItems added in v0.1.2

func (fake *ReferenceIterator) TotalItems() int

func (*ReferenceIterator) TotalItemsCallCount added in v0.1.2

func (fake *ReferenceIterator) TotalItemsCallCount() int

func (*ReferenceIterator) TotalItemsReturns added in v0.1.2

func (fake *ReferenceIterator) TotalItemsReturns(result1 int)

func (*ReferenceIterator) TotalItemsReturnsOnCall added in v0.1.2

func (fake *ReferenceIterator) TotalItemsReturnsOnCall(i int, result1 int)

type SignatureVerifier

type SignatureVerifier struct {
	VerifyRequestStub func(req *http.Request) (bool, *url.URL, error)
	// contains filtered or unexported fields
}

func (*SignatureVerifier) Invocations

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

func (*SignatureVerifier) VerifyRequest

func (fake *SignatureVerifier) VerifyRequest(req *http.Request) (bool, *url.URL, error)

func (*SignatureVerifier) VerifyRequestArgsForCall

func (fake *SignatureVerifier) VerifyRequestArgsForCall(i int) *http.Request

func (*SignatureVerifier) VerifyRequestCallCount

func (fake *SignatureVerifier) VerifyRequestCallCount() int

func (*SignatureVerifier) VerifyRequestReturns

func (fake *SignatureVerifier) VerifyRequestReturns(result1 bool, result2 *url.URL, result3 error)

func (*SignatureVerifier) VerifyRequestReturnsOnCall

func (fake *SignatureVerifier) VerifyRequestReturnsOnCall(i int, result1 bool, result2 *url.URL, result3 error)

type Subscriber

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

Subscriber implements a mock activity subscriber.

func NewSubscriber

func NewSubscriber(activityChan <-chan *vocab.ActivityType) *Subscriber

NewSubscriber returns a new mock activity subscriber.

func (*Subscriber) Activities

func (m *Subscriber) Activities() []*vocab.ActivityType

Activities returns the activities that were received by the subscriber.

type UndeliverableActivity

type UndeliverableActivity struct {
	Activity *vocab.ActivityType
	ToURL    string
}

UndeliverableActivity holds an undeliverable activity along with the URL to which the activity could not be delivered.

type UndeliverableHandler

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

UndeliverableHandler implements a mock undeliverable activity handler.

func NewUndeliverableHandler

func NewUndeliverableHandler() *UndeliverableHandler

NewUndeliverableHandler returns a mock undeliverable activity handler.

func (*UndeliverableHandler) Activities

func (h *UndeliverableHandler) Activities() []*UndeliverableActivity

Activities returns the undeliverable activities.

func (*UndeliverableHandler) HandleUndeliverableActivity

func (h *UndeliverableHandler) HandleUndeliverableActivity(activity *vocab.ActivityType, toURL string)

HandleUndeliverableActivity adds the given undeliverable activity to a map that may be later queried by unit tests.

type WebFingerResolver added in v0.1.2

type WebFingerResolver struct {
	Err error
	URI string
}

WebFingerResolver implements a mock WebFinger resolver.

func (m *WebFingerResolver) ResolveHostMetaLink(uri, _ string) (string, error)

ResolveHostMetaLink returns either the specified error, the specified URI, otherwise, if neither were specified then the URI in the argument is returned.

type WitnessHandler

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

WitnessHandler implements a mock witness handler.

func NewWitnessHandler

func NewWitnessHandler() *WitnessHandler

NewWitnessHandler returns a mock witness handler.

func (*WitnessHandler) AnchorCreds

func (m *WitnessHandler) AnchorCreds() [][]byte

AnchorCreds returns all of the anchor credentials that were witnessed by this mock.

func (*WitnessHandler) WithError

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

WithError injects an error.

func (*WitnessHandler) WithProof

func (m *WitnessHandler) WithProof(proof []byte) *WitnessHandler

WithProof sets the proof to be returned from the witness handler.

func (*WitnessHandler) Witness

func (m *WitnessHandler) Witness(anchorCred []byte) ([]byte, error)

Witness adds the anchor credential to a list that can be inspected using the AnchorCreds function and returns the injected proof/error.

Jump to

Keyboard shortcuts

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