testutils

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

nolint: gomnd

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNoError added in v0.0.3

func CheckNoError(t *testing.T, err error)

func CheckNoServerError added in v0.0.9

func CheckNoServerError(t *testing.T, err error)

func CopyHeaders added in v0.2.0

func CopyHeaders(from http.Header, to http.Header)

func FsFromMap added in v0.0.8

func FsFromMap(t *testing.T, files map[string]string) afero.Fs

FsFromMap creates afero.Fs in memory from map. Where key is a filename and value is file context.

func LogTest added in v0.0.7

func LogTest(action func(t *testing.T, output *bytes.Buffer)) func(t *testing.T)

func NewTestClient

func NewTestClient(responseCreator RoundTripFunc) *http.Client

func ReadBody added in v0.0.6

func ReadBody(t *testing.T, recorder *httptest.ResponseRecorder) string

func ReadHeader added in v0.0.7

func ReadHeader(t *testing.T, recorder *httptest.ResponseRecorder) http.Header

func Times added in v0.2.0

func Times(n int, function func(n int))

func WithTmpCerts added in v0.0.9

func WithTmpCerts(fs afero.Fs, action func(t *testing.T, certs *Certs)) func(t *testing.T)

Types

type Certs added in v0.0.9

type Certs struct {
	ServerTLSConf *tls.Config
	ClientTLSConf *tls.Config
	CertPath      string
	KeyPath       string
}

type CountableHandler added in v0.2.0

type CountableHandler struct {
	// contains filtered or unexported fields
}

func NewCounter added in v0.2.0

func NewCounter(handler handlerFunc) *CountableHandler

func (*CountableHandler) Count added in v0.2.0

func (t *CountableHandler) Count() int

func (*CountableHandler) Reset added in v0.2.0

func (t *CountableHandler) Reset()

func (*CountableHandler) ServeHTTP added in v0.2.0

func (t *CountableHandler) ServeHTTP(writer contracts.ResponseWriter, request *contracts.Request)

type RoundTripFunc

type RoundTripFunc func(req *http.Request) *http.Response

func (RoundTripFunc) RoundTrip

func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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