study

package
v0.0.55 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(expected interface{}, actual interface{}) error

func RoundTripperQueue

func RoundTripperQueue(t *testing.T, queue []RoundTripFunc) http.RoundTripper

Types

type AssertFailure

type AssertFailure struct {
	Expected interface{} `json:"expected"`
	Actual   interface{} `json:"actual"`
}

type ExpectedTestRequest

type ExpectedTestRequest struct {
	Method    string
	Path      string
	Query     url.Values
	Validator func(r *http.Request) error
}

type ResponseModifier added in v0.0.37

type ResponseModifier interface {
	ModifyResponse(r *http.Response)
}

type ResponseModifierFunc added in v0.0.37

type ResponseModifierFunc func(*http.Response)

func WithResponseHeaders added in v0.0.37

func WithResponseHeaders(headers map[string][]string) ResponseModifierFunc

func (ResponseModifierFunc) ModifyResponse added in v0.0.37

func (r ResponseModifierFunc) ModifyResponse(response *http.Response)

type RoundTripFunc

type RoundTripFunc func(t *testing.T, request *http.Request) (*http.Response, error)

func ServeAndValidate

func ServeAndValidate(t *testing.T, r TestResponse, expected ExpectedTestRequest) RoundTripFunc

type RoundTripper

type RoundTripper struct {
	RoundTripFunc func(*http.Request) (*http.Response, error)
}

func (RoundTripper) RoundTrip

func (r RoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

type TestResponse

type TestResponse interface {
	CreateResponse() (*http.Response, error)
}

type TestResponseFile

type TestResponseFile struct {
	StatusCode        int
	FilePath          string
	ResponseModifiers []ResponseModifier
}

func (*TestResponseFile) CreateResponse

func (f *TestResponseFile) CreateResponse() (*http.Response, error)

type TestResponseNoContent added in v0.0.35

type TestResponseNoContent struct {
	StatusCode int
}

func (*TestResponseNoContent) CreateResponse added in v0.0.35

func (f *TestResponseNoContent) CreateResponse() (*http.Response, error)

type TestResponseURLError added in v0.0.50

type TestResponseURLError struct {
	URLError *url.Error
}

func (*TestResponseURLError) CreateResponse added in v0.0.50

func (f *TestResponseURLError) CreateResponse() (*http.Response, error)

Jump to

Keyboard shortcuts

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