test

package
v0.0.0-...-20c75cd Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(t *testing.T, content interface{}) []byte

Marshal is a factory method that returns json-marshalled content.

func NewSUT

func NewSUT(runFunc RunFunc, routables []routable.Contract) (context.CancelFunc, *sync.WaitGroup, *mux.Router)

NewSUT returns a new system under test for acceptance testing.

func SendRequestWithBody

func SendRequestWithBody(
	t *testing.T,
	router *mux.Router,
	method string,
	url string,
	body []byte) *httptest.ResponseRecorder

SendRequestWithBody is common implementation to create recorder, send a request, and return recorder for evaluation.

func SendRequestWithoutBody

func SendRequestWithoutBody(t *testing.T, router *mux.Router, method, url string) *httptest.ResponseRecorder

SendRequestWithoutBody is common implementation to create recorder, send a request that has no body, and return recorder for evaluation.

Types

type RunFunc

type RunFunc func(
	ctx context.Context,
	cancel context.CancelFunc,
	muxRouter *mux.Router,
	routables []routable.Contract,
	serverAddress *string,
)

MainFunc defines the signature of the function used to start a service.

Jump to

Keyboard shortcuts

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