mock

package
v0.0.0-...-14e5604 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DailyRPC    = "agenda.v1.Agenda/Daily"
	ScheduleRPC = "agenda.v1.Agenda/Schedule"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgendaServer

type AgendaServer struct {
	api.UnimplementedAgendaServer

	Calls      map[string]int
	OnSchedule func(context.Context, *api.Item) (*api.Item, error)
	OnDaily    func(context.Context, *api.Day) (*api.Docket, error)
	// contains filtered or unexported fields
}

func New

func New(bufnet *utils.Listener) *AgendaServer

New creates a new mock RemotePeer. If bufnet is nil, one is created for the user.

func (*AgendaServer) Channel

func (s *AgendaServer) Channel() *utils.Listener

func (*AgendaServer) Daily

func (s *AgendaServer) Daily(ctx context.Context, in *api.Day) (out *api.Docket, err error)

func (*AgendaServer) Reset

func (s *AgendaServer) Reset()

func (*AgendaServer) Schedule

func (s *AgendaServer) Schedule(ctx context.Context, in *api.Item) (out *api.Item, err error)

func (*AgendaServer) Shutdown

func (s *AgendaServer) Shutdown()

func (*AgendaServer) UseError

func (s *AgendaServer) UseError(rpc string, code codes.Code, msg string) error

UseError allows you to specify a gRPC status error to return from the specified RPC.

func (*AgendaServer) UseFixture

func (s *AgendaServer) UseFixture(rpc, path string) (err error)

UseFixture loadsa a JSON fixture from disk (usually in a testdata folder) to use as the protocol buffer response to the specified RPC, simplifying handler mocking.

Jump to

Keyboard shortcuts

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