mocks

package
Version: v1.0.0-alpha3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Connect is the Connect operation (used in the OperationMap)
	Connect clientmocks.Operation = "connect"

	// BadRequestResult indicates that the operation should use invalid seek info
	BadRequestResult clientmocks.Result = "bad-request"

	// ForbiddenResult indicates that the user does not have permission to perform the operation
	ForbiddenResult clientmocks.Result = "forbidden"
)

Variables

View Source
var BlockEventFactory = func(block servicemocks.Block) servicemocks.BlockEvent {
	b, ok := block.(*servicemocks.BlockWrapper)
	if !ok {
		panic(fmt.Sprintf("Invalid block type: %T", block))
	}
	return NewBlockEvent(b.Block())
}

BlockEventFactory creates block events

View Source
var FilteredBlockEventFactory = func(block servicemocks.Block) servicemocks.BlockEvent {
	b, ok := block.(*servicemocks.FilteredBlockWrapper)
	if !ok {
		panic(fmt.Sprintf("Invalid block type: %T", block))
	}
	return NewFilteredBlockEvent(b.Block())
}

FilteredBlockEventFactory creates filtered block events

Functions

func NewBlockEvent

func NewBlockEvent(block *cb.Block) *pb.DeliverResponse

NewBlockEvent returns a new mock block event initialized with the given block

func NewFilteredBlockEvent

func NewFilteredBlockEvent(fblock *pb.FilteredBlock) *pb.DeliverResponse

NewFilteredBlockEvent returns a new mock filtered block event initialized with the given filtered block

Types

type MockConnection

type MockConnection struct {
	clientmocks.MockConnection
}

MockConnection is a fake connection used for unit testing

func NewConnection

func NewConnection(opts ...clientmocks.Opt) *MockConnection

NewConnection returns a new MockConnection using the given options

func (*MockConnection) Receive

func (c *MockConnection) Receive(eventch chan<- interface{})

Receive implements the MockConnection interface

func (*MockConnection) Send

func (c *MockConnection) Send(sinfo *ab.SeekInfo) error

Send mockcore sending seek info to the deliver server

Jump to

Keyboard shortcuts

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