testutils

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(t *testing.T, expected, actual interface{})

Equal reports a test failure if expected != actual (using Go's ==).

func HTTPBodyContainsf

func HTTPBodyContainsf(t *testing.T, handler http.HandlerFunc, method, urlStr string, values url.Values, expected string, msgAndArgs ...interface{})

HTTPBodyContainsf sends a request through handler and checks that the response body contains the expected substring.

func HTTPBodyNotContainsf

func HTTPBodyNotContainsf(t *testing.T, handler http.HandlerFunc, method, urlStr string, values url.Values, expected string, msgAndArgs ...interface{})

HTTPBodyNotContainsf sends a request through handler and checks that the response body does not contain the expected substring.

func MakePostRequest

func MakePostRequest(t *testing.T, path string, values url.Values) (*httptest.ResponseRecorder, *http.Request)

MakePostRequest is a small helper for tests that need to construct a POST request with form values and an httptest.ResponseRecorder.

func NewAuthSharedForTest

func NewAuthSharedForTest() types.AuthSharedInterface

func NewPasswordlessConfigForTest

func NewPasswordlessConfigForTest() types.ConfigPasswordless

NewPasswordlessConfigForTest returns a ConfigPasswordless pre-populated with safe defaults for tests.

func NewUsernameAndPasswordConfigForTest

func NewUsernameAndPasswordConfigForTest() types.ConfigUsernameAndPassword

NewUsernameAndPasswordConfigForTest returns a ConfigUsernameAndPassword pre-populated with safe defaults for tests.

func Nil

func Nil(t *testing.T, value interface{})

Nil reports a test failure if value is not nil.

func NotNil

func NotNil(t *testing.T, value interface{})

NotNil reports a test failure if value is nil.

func SetFuncUserFindByAuthTokenForTest

func SetFuncUserFindByAuthTokenForTest(a types.AuthSharedInterface, fn func(ctx context.Context, token string, options types.UserAuthOptions) (string, error))

SetFuncUserFindByAuthTokenForTest allows tests to control auth-token lookup behaviour.

func SetLoginURLForTest

func SetLoginURLForTest(a types.AuthSharedInterface, url string)

SetLoginURLForTest allows tests to configure the login URL used by LinkLogin.

func SetPasswordlessForTest

func SetPasswordlessForTest(a types.AuthSharedInterface, passwordless bool)

func SetRegistrationForTest

func SetRegistrationForTest(a types.AuthSharedInterface, registration bool)

Test helpers to configure additional flags on the shared auth test double.

func SetUseCookiesForTest

func SetUseCookiesForTest(a types.AuthSharedInterface, useCookies bool)

SetUseCookiesForTest allows tests to configure whether cookies are used.

func SetVerificationForTest

func SetVerificationForTest(a types.AuthSharedInterface, verification bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

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