testutils

package
v0.0.0-...-0081ee3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertContains

func AssertContains[T comparable](t *testing.T, expected T, testee []T, title string)

func AssertContainsAll

func AssertContainsAll[T comparable](t *testing.T, expected []T, testee []T, title string)

func AssertEquals

func AssertEquals(t *testing.T, expected, actual any, title string)

func AssertError

func AssertError(t *testing.T, err error, title string)

func AssertNoError

func AssertNoError(t *testing.T, err error, title string)

func AssertNotEquals

func AssertNotEquals(t *testing.T, expected, actual any, title string)

func AssertStringContains

func AssertStringContains(t *testing.T, expected, testee, title string)

Types

type Response

type Response struct {
	T          *testing.T
	StatusCode int
	// contains filtered or unexported fields
}

func NewResponse

func NewResponse(t *testing.T, response *http.Response) Response

func (*Response) Body

func (r *Response) Body() map[string]interface{}

func (*Response) Decode

func (r *Response) Decode(value interface{}) error

type TestServer

type TestServer struct {
	*httptest.Server
	T      *testing.T
	Client *http.Client
}

func NewTestServer

func NewTestServer(t *testing.T, handler http.Handler) *TestServer

func (*TestServer) DELETE

func (ts *TestServer) DELETE(path string) Response

func (*TestServer) GET

func (ts *TestServer) GET(path string) Response

func (*TestServer) POST

func (ts *TestServer) POST(path string, body string) Response

func (*TestServer) PUT

func (ts *TestServer) PUT(path string, body string) Response

Jump to

Keyboard shortcuts

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