mock

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpectedAPICall

type ExpectedAPICall[IN, OUT any] struct {
	Method              string
	APIPath             string
	ExpectedRequestBody *IN
	APIResponse         OUT
	// contains filtered or unexported fields
}

func (*ExpectedAPICall[_, _]) AllCalledExactlyOnce

func (e *ExpectedAPICall[_, _]) AllCalledExactlyOnce() bool

func (*ExpectedAPICall[_, _]) CallCounts

func (e *ExpectedAPICall[_, _]) CallCounts() []int

func (*ExpectedAPICall[I, _]) HandlerFunction

func (e *ExpectedAPICall[I, _]) HandlerFunction(t *testing.T) func(http.ResponseWriter, *http.Request)

func (*ExpectedAPICall[_, _]) PathHandler

func (e *ExpectedAPICall[_, _]) PathHandler(t *testing.T) (string, http.HandlerFunc)

func (*ExpectedAPICall[_, _]) Signature

func (e *ExpectedAPICall[_, _]) Signature() string

type ExpectedAPICallData

type ExpectedAPICallData[IN, OUT any] struct {
	Method              string
	ExpectedRequestBody *IN
	APIResponse         OUT
	// contains filtered or unexported fields
}

type ExpectedAPICallMulti

type ExpectedAPICallMulti[IN, OUT any] struct {
	APIPath string
	Calls   []ExpectedAPICallData[IN, OUT]
}

ExpectedAPICallMulti is for cases where you expect multiple calls to the same APIPath with different bodies. Needed because you cannot register two handlers for the same path Bulk Proxy instance delete for example

func (*ExpectedAPICallMulti[_, _]) AllCalledExactlyOnce

func (e *ExpectedAPICallMulti[_, _]) AllCalledExactlyOnce() bool

func (*ExpectedAPICallMulti[_, _]) CallCounts

func (e *ExpectedAPICallMulti[_, _]) CallCounts() []int

func (*ExpectedAPICallMulti[I, O]) HandlerFunction

func (e *ExpectedAPICallMulti[I, O]) HandlerFunction(t *testing.T) func(http.ResponseWriter, *http.Request)

func (*ExpectedAPICallMulti[_, _]) PathHandler

func (e *ExpectedAPICallMulti[_, _]) PathHandler(t *testing.T) (string, http.HandlerFunc)

func (*ExpectedAPICallMulti[_, _]) Signature

func (e *ExpectedAPICallMulti[_, _]) Signature() string

type ExpectedCall

type ExpectedCall interface {
	CallCounts() []int
	AllCalledExactlyOnce() bool
	PathHandler(t *testing.T) (string, http.HandlerFunc)
	Signature() string
}

type ModelService

type ModelService struct {
	Server        *httptest.Server
	ExpectedCalls []ExpectedCall
}

func NewModelService

func NewModelService(t *testing.T, expectedCall ...ExpectedCall) *ModelService

func (*ModelService) AssertAllCalledExactlyOnce

func (m *ModelService) AssertAllCalledExactlyOnce(t *testing.T) bool

func (*ModelService) Close

func (m *ModelService) Close()

func (*ModelService) URL

func (m *ModelService) URL() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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