testutil

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fixture

func Fixture(path string) string

Fixture loads a fixture file to a string

func MockClient

func MockClient(
	t *testing.T,
	fixture string,
	output *RequestData,
	callback HTTPHandler) (*commercetools.Client, *httptest.Server)

MockClient returns a client to mock HTTP requests with a callback function

Types

type HTTPHandler

type HTTPHandler func(w http.ResponseWriter, r *http.Request)

HTTPHandler type defines callback from doing a mock HTTP request

type RequestData

type RequestData struct {
	URL    url.URL
	Body   []byte
	Method string
	JSON   string
}

RequestData holds test HTTP request data

Jump to

Keyboard shortcuts

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