mockrouting

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mockrouting provides mock implementations of the routing package's interfaces. Both the hand-written testify-based RouteParamManager and the moq-generated RouteParamManagerMock live here during the testify → moq migration. New test code should prefer RouteParamManagerMock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RouteParamManagerMock

type RouteParamManagerMock struct {
	// BuildRouteParamIDFetcherFunc mocks the BuildRouteParamIDFetcher method.
	BuildRouteParamIDFetcherFunc func(logger logging.Logger, key string, logDescription string) func(req *http.Request) uint64

	// BuildRouteParamStringIDFetcherFunc mocks the BuildRouteParamStringIDFetcher method.
	BuildRouteParamStringIDFetcherFunc func(key string) func(req *http.Request) string
	// contains filtered or unexported fields
}

RouteParamManagerMock is a mock implementation of routing.RouteParamManager.

func TestSomethingThatUsesRouteParamManager(t *testing.T) {

	// make and configure a mocked routing.RouteParamManager
	mockedRouteParamManager := &RouteParamManagerMock{
		BuildRouteParamIDFetcherFunc: func(logger logging.Logger, key string, logDescription string) func(req *http.Request) uint64 {
			panic("mock out the BuildRouteParamIDFetcher method")
		},
		BuildRouteParamStringIDFetcherFunc: func(key string) func(req *http.Request) string {
			panic("mock out the BuildRouteParamStringIDFetcher method")
		},
	}

	// use mockedRouteParamManager in code that requires routing.RouteParamManager
	// and then make assertions.

}

func (*RouteParamManagerMock) BuildRouteParamIDFetcher

func (mock *RouteParamManagerMock) BuildRouteParamIDFetcher(logger logging.Logger, key string, logDescription string) func(req *http.Request) uint64

BuildRouteParamIDFetcher calls BuildRouteParamIDFetcherFunc.

func (*RouteParamManagerMock) BuildRouteParamIDFetcherCalls

func (mock *RouteParamManagerMock) BuildRouteParamIDFetcherCalls() []struct {
	Logger         logging.Logger
	Key            string
	LogDescription string
}

BuildRouteParamIDFetcherCalls gets all the calls that were made to BuildRouteParamIDFetcher. Check the length with:

len(mockedRouteParamManager.BuildRouteParamIDFetcherCalls())

func (*RouteParamManagerMock) BuildRouteParamStringIDFetcher

func (mock *RouteParamManagerMock) BuildRouteParamStringIDFetcher(key string) func(req *http.Request) string

BuildRouteParamStringIDFetcher calls BuildRouteParamStringIDFetcherFunc.

func (*RouteParamManagerMock) BuildRouteParamStringIDFetcherCalls

func (mock *RouteParamManagerMock) BuildRouteParamStringIDFetcherCalls() []struct {
	Key string
}

BuildRouteParamStringIDFetcherCalls gets all the calls that were made to BuildRouteParamStringIDFetcher. Check the length with:

len(mockedRouteParamManager.BuildRouteParamStringIDFetcherCalls())

Jump to

Keyboard shortcuts

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