testutil

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTestConfigurationAndDependencies

func GetTestConfigurationAndDependencies(t *testing.T, ctx context.Context, logger *logrus.Logger) (*config.Config, *dependencies.Dependencies)

func GetValidBookmark

func GetValidBookmark() *model.BookmarkDTO

func NewGin

func NewGin() *gin.Engine

NewGin returns a new gin engine with test mode enabled.

func NewTestResponseFromBytes

func NewTestResponseFromBytes(b []byte) (*testResponse, error)

func NewTestResponseFromReader

func NewTestResponseFromReader(r io.Reader) (*testResponse, error)

func PerformRequest

func PerformRequest(handler http.Handler, method, path string, options ...Option) *httptest.ResponseRecorder

func PerformRequestWithRecorder

func PerformRequestWithRecorder(recorder *httptest.ResponseRecorder, r http.Handler, method, path string, options ...Option) *httptest.ResponseRecorder

Types

type Option

type Option = func(*http.Request)

func WithBody

func WithBody(body string) Option

func WithHeader

func WithHeader(name, value string) Option

Jump to

Keyboard shortcuts

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