commontest

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUsername = "foobar"
)

Variables

This section is empty.

Functions

func AuthenticatedRequest added in v0.6.0

func AuthenticatedRequest(t *testing.T, r *http.Request, opts AuthOpts)

func NewDB added in v0.11.0

func NewDB(t *testing.T, name string) (*sql.DB, func())

func Ptr added in v0.9.0

func Ptr[T any](val T) *T

func RequireNotOkStatus added in v0.6.0

func RequireNotOkStatus(t *testing.T, resp *http.Response)

func RequireOkStatus added in v0.6.0

func RequireOkStatus(t *testing.T, resp *http.Response)

func SetJsonHeader added in v0.5.0

func SetJsonHeader(r *http.Request)

func SetupDbAndRouter

func SetupDbAndRouter(t *testing.T, name string, routeFunc func(*fiber.App, *sql.DB)) (*fiber.App, func())

func T_call_fail added in v0.6.0

func T_call_fail(t *testing.T, app *fiber.App, req *http.Request) (int, common.OutboundErrResponse)

func T_call_ok added in v0.6.0

func T_call_ok[T any](t *testing.T, app *fiber.App, req *http.Request) (int, T)

func T_req added in v0.6.0

func T_req[T any](t *testing.T, r Req[T]) *http.Request

Types

type AuthOpts added in v0.6.0

type AuthOpts struct {
	Username *string
}

type Req added in v0.6.0

type Req[T any] struct {
	Method string
	Path   string
	Body   *T
	Auth   *AuthOpts
}

Jump to

Keyboard shortcuts

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