testutil

package
v1.0.0-10 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestEmptyResponse

func TestEmptyResponse(t *testing.T, w *httptest.ResponseRecorder)

TestEmptyResponse tests an empty 204 response

func TestErrorExpectedResponse

func TestErrorExpectedResponse(t *testing.T, router *mux.Router, method, url string, data io.Reader, accessToken, msg string, code int, assertExpectations func())

TestErrorExpectedResponse is the generic test code for testing for a bad response

func TestGetErrorExpectedResponse

func TestGetErrorExpectedResponse(t *testing.T, router *mux.Router, url, accessToken, msg string, code int, assertExpectations func())

TestGetErrorExpectedResponse ...

func TestListValidResponse

func TestListValidResponse(t *testing.T, router *mux.Router, path, entity, accessToken string, items []interface{}, assertExpectations func())

TestListValidResponse ...

func TestListValidResponseWithParams

func TestListValidResponseWithParams(t *testing.T, router *mux.Router, path, entity, accessToken string, items []interface{}, assertExpectations func(), params map[string]string)

TestListValidResponseWithParams tests a list endpoint for a valid response with default settings

func TestPostErrorExpectedResponse

func TestPostErrorExpectedResponse(t *testing.T, router *mux.Router, url string, data io.Reader, accessToken, msg string, code int, assertExpectations func())

TestPostErrorExpectedResponse ...

func TestPutErrorExpectedResponse

func TestPutErrorExpectedResponse(t *testing.T, router *mux.Router, url string, data io.Reader, accessToken, msg string, code int, assertExpectations func())

TestPutErrorExpectedResponse ...

func TestResponseBody

func TestResponseBody(t *testing.T, w *httptest.ResponseRecorder, expected string)

TestResponseBody tests response body is equal to expected string

func TestResponseForError

func TestResponseForError(t *testing.T, w *httptest.ResponseRecorder, msg string, code int)

TestResponseForError tests a response w to see if it returned an error msg with http code

func TestResponseObject

func TestResponseObject(t *testing.T, w *httptest.ResponseRecorder, expected interface{}, code int)

TestResponseObject tests response body is equal to expected object in JSON form

Types

This section is empty.

Jump to

Keyboard shortcuts

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