testutils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAPIProviderWithGetResponses

func CreateAPIProviderWithGetResponses[K providertypes.ResponseKey, V providertypes.ResponseValue](
	t *testing.T,
	logger *zap.Logger,
	cfg config.ProviderConfig,
	ids []K,
	responses []providertypes.GetResponse[K, V],
	timeout time.Duration,
) *base.Provider[K, V]

CreateAPIProviderWithGetResponses creates a new provider with the given responses.

func CreateAPIProviderWithResponseFn

func CreateAPIProviderWithResponseFn[K providertypes.ResponseKey, V providertypes.ResponseValue](
	t *testing.T,
	logger *zap.Logger,
	cfg config.ProviderConfig,
	ids []K,
	fn func(context.Context, chan<- providertypes.GetResponse[K, V]),
) *base.Provider[K, V]

CreateAPIProviderWithResponseFn creates a new provider with the given response function.

func CreateAPIQueryHandlerWithGetResponses

func CreateAPIQueryHandlerWithGetResponses[K providertypes.ResponseKey, V providertypes.ResponseValue](
	t *testing.T,
	logger *zap.Logger,
	responses []providertypes.GetResponse[K, V],
	timeout time.Duration,
) handlers.APIQueryHandler[K, V]

CreateAPIQueryHandlerWithGetResponses creates a mock query handler that returns the given responses every time it is invoked.

func CreateAPIQueryHandlerWithResponseFn

func CreateAPIQueryHandlerWithResponseFn[K providertypes.ResponseKey, V providertypes.ResponseValue](
	t *testing.T,
	fn func(context.Context, chan<- providertypes.GetResponse[K, V]),
) handlers.APIQueryHandler[K, V]

CreateAPIQueryHandlerWithResponseFn creates a mock query handler that invokes the given function every time it is invoked. The function should utilize the response channel to send responses to the provider.

func CreateResponseFromJSON

func CreateResponseFromJSON(m string) *http.Response

CreateResponseFromJSON creates a http response from a json string.

func CreateWebSocketProviderWithGetResponses

func CreateWebSocketProviderWithGetResponses[K providertypes.ResponseKey, V providertypes.ResponseValue](
	t *testing.T,
	timeout time.Duration,
	ids []K,
	cfg config.ProviderConfig,
	logger *zap.Logger,
	responses []providertypes.GetResponse[K, V],
) *base.Provider[K, V]

CreateWebSocketProviderWithGetResponses creates a new websocket provider with the given responses.

func CreateWebSocketProviderWithResponseFn

func CreateWebSocketProviderWithResponseFn[K providertypes.ResponseKey, V providertypes.ResponseValue](
	t *testing.T,
	cfg config.ProviderConfig,
	logger *zap.Logger,
	fn func(context.Context, chan<- providertypes.GetResponse[K, V]),
) *base.Provider[K, V]

CreateWebSocketProviderWithResponseFn creates a new websocket provider with the given response function.

func CreateWebSocketQueryHandlerWithGetResponses

func CreateWebSocketQueryHandlerWithGetResponses[K providertypes.ResponseKey, V providertypes.ResponseValue](
	t *testing.T,
	timeout time.Duration,
	logger *zap.Logger,
	responses []providertypes.GetResponse[K, V],
) handlers.WebSocketQueryHandler[K, V]

CreateWebSocketQueryHandlerWithGetResponses creates a mock query handler that returns the given responses every time it is invoked.

func CreateWebSocketQueryHandlerWithResponseFn

func CreateWebSocketQueryHandlerWithResponseFn[K providertypes.ResponseKey, V providertypes.ResponseValue](
	t *testing.T,
	fn func(context.Context, chan<- providertypes.GetResponse[K, V]),
) handlers.WebSocketQueryHandler[K, V]

CreateWebSocketQueryHandlerWithResponseFn creates a mock query handler that invokes the given function every time it is invoked. The function should utilize the response channel to send responses to the provider.

Types

This section is empty.

Jump to

Keyboard shortcuts

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