Documentation
¶
Overview ¶
Package testutils contains common functions for integration/load tests
Index ¶
- Constants
- Variables
- func BuildArbitraryImage(widthAndHeight int) image.Image
- func BuildArbitraryImagePNGBytes(widthAndHeight int) (img image.Image, imgBytes []byte)
- func BuildTestRequest(t *testing.T) *http.Request
- func MatchType[T any]() any
- type MockHTTPHandler
- type MockHTTPResponseWriter
- type MockReadCloser
- type MockWriter
Constants ¶
View Source
const ( Example32ByteKey = "HEREISA32CHARSECRETWHICHISMADEUP" Example64ByteKey = "HEREISA64CHARSECRETWHICHISMADEUPHEREISA64CHARSECRETWHICHISMADEUP" )
Variables ¶
View Source
var ( ContextMatcher = MatchType[context.Context]() QueryFilterMatcher = MatchType[*filtering.QueryFilter]() HTTPRequestMatcher = MatchType[*http.Request]() HTTPResponseWriterMatcher = MatchType[http.ResponseWriter]() )
Functions ¶
func BuildArbitraryImage ¶
BuildArbitraryImage builds an image with a bunch of colors in it.
func BuildArbitraryImagePNGBytes ¶
BuildArbitraryImagePNGBytes builds an image with a bunch of colors in it.
func BuildTestRequest ¶
BuildTestRequest builds an arbitrary *http.Request.
Types ¶
type MockHTTPHandler ¶
MockHTTPHandler is a mocked http.Handler.
func (*MockHTTPHandler) ServeHTTP ¶
func (m *MockHTTPHandler) ServeHTTP(res http.ResponseWriter, req *http.Request)
ServeHTTP satisfies our interface requirements.
type MockHTTPResponseWriter ¶
MockHTTPResponseWriter is a mock http.ResponseWriter.
func (*MockHTTPResponseWriter) Header ¶
func (m *MockHTTPResponseWriter) Header() http.Header
Header satisfies our interface requirements.
func (*MockHTTPResponseWriter) Write ¶
func (m *MockHTTPResponseWriter) Write(in []byte) (int, error)
Write satisfies our interface requirements.
func (*MockHTTPResponseWriter) WriteHeader ¶
func (m *MockHTTPResponseWriter) WriteHeader(statusCode int)
WriteHeader satisfies our interface requirements.
type MockReadCloser ¶
MockReadCloser mocks a io.ReadCloser.
func (*MockReadCloser) Close ¶
func (m *MockReadCloser) Close() error
Close implements the io.ReadCloser interface.
type MockWriter ¶
MockWriter mocks a io.Writer.
Click to show internal directories.
Click to hide internal directories.