testutil

package
v2.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultipartFile

type MultipartFile struct {
	FieldName   string
	FileName    string
	Path        string
	ContentType string
}

type RequestOpt

type RequestOpt func(*requestConfig) error

func WithCookie

func WithCookie(cookie *http.Cookie) RequestOpt

func WithHeader

func WithHeader(key, value string) RequestOpt

type TestResponse

type TestResponse struct {
	*http.Response
	// contains filtered or unexported fields
}

func (*TestResponse) AssertContains

func (r *TestResponse) AssertContains(text string) *TestResponse

func (*TestResponse) AssertJSON

func (r *TestResponse) AssertJSON(v any) *TestResponse

func (*TestResponse) AssertRedirectsTo

func (r *TestResponse) AssertRedirectsTo(path string) *TestResponse

func (*TestResponse) AssertSSEEvent

func (r *TestResponse) AssertSSEEvent(event, data string) *TestResponse

func (*TestResponse) AssertStatus

func (r *TestResponse) AssertStatus(code int) *TestResponse

type TestServer

type TestServer struct {
	Server    *httptest.Server
	Container *shipapp.Container
	// contains filtered or unexported fields
}

func NewTestServer

func NewTestServer(t testing.TB) *TestServer

func (*TestServer) AsUser

func (s *TestServer) AsUser(userID int64) RequestOpt

func (*TestServer) Get

func (s *TestServer) Get(path string, opts ...RequestOpt) *TestResponse

func (*TestServer) PostForm

func (s *TestServer) PostForm(path string, form url.Values, opts ...RequestOpt) *TestResponse

func (*TestServer) PostJSON

func (s *TestServer) PostJSON(path string, payload any, opts ...RequestOpt) *TestResponse

func (*TestServer) PostMultipart

func (s *TestServer) PostMultipart(path string, fields map[string]string, files []MultipartFile, opts ...RequestOpt) *TestResponse

Jump to

Keyboard shortcuts

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