test

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeadersWithAuth

func HeadersWithAuth(t *testing.T, token string) http.Header

func HeadersWithConfigurableAuth

func HeadersWithConfigurableAuth(t *testing.T, scheme string, token string) http.Header

func ParseResponseBody

func ParseResponseBody(t *testing.T, res *httptest.ResponseRecorder, v interface{})

func PerformRequest

func PerformRequest(t *testing.T, s *api.Server, method string, path string, body GenericPayload, headers http.Header) *httptest.ResponseRecorder

func PerformRequestWithArray

func PerformRequestWithArray(t *testing.T, s *api.Server, method string, path string, body GenericArrayPayload, headers http.Header) *httptest.ResponseRecorder

func PerformRequestWithArrayAndParams

func PerformRequestWithArrayAndParams(t *testing.T, s *api.Server, method string, path string, body GenericArrayPayload, headers http.Header, queryParams map[string]string) *httptest.ResponseRecorder

func PerformRequestWithParams

func PerformRequestWithParams(t *testing.T, s *api.Server, method string, path string, body GenericPayload, headers http.Header, queryParams map[string]string) *httptest.ResponseRecorder

func PerformRequestWithRawBody

func PerformRequestWithRawBody(t *testing.T, s *api.Server, method string, path string, body io.Reader, headers http.Header, queryParams map[string]string) *httptest.ResponseRecorder

func WithTestServer

func WithTestServer(t *testing.T, closure func(s *api.Server))

WithTestServer returns a fully configured server (using the default server config).

func WithTestServerConfigurable

func WithTestServerConfigurable(t *testing.T, config api.ServerConfig, closure func(s *api.Server))

WithTestServerConfigurable returns a fully configured server, allowing for configuration using the provided server config.

func WithTestServerConfigurableContext

func WithTestServerConfigurableContext(ctx context.Context, t *testing.T, config api.ServerConfig, closure func(s *api.Server))

WithTestServerConfigurableContext returns a fully configured server, allowing for configuration using the provided server config. The provided context will be used during setup (instead of the default background context).

Types

type GenericArrayPayload

type GenericArrayPayload []interface{}

func (GenericArrayPayload) Reader

func (g GenericArrayPayload) Reader(t *testing.T) *bytes.Reader

type GenericPayload

type GenericPayload map[string]interface{}

func (GenericPayload) Reader

func (g GenericPayload) Reader(t *testing.T) *bytes.Reader

Jump to

Keyboard shortcuts

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