Documentation
¶
Index ¶
- Constants
- func BaseURLFromContext(ctx context.Context) string
- func ContextWithBaseURL(ctx context.Context, baseURL string) context.Context
- func ContextWithCustomBodyCheck(ctx context.Context, checkID string, checkFunc check.BodyCustomCheckerFunc) context.Context
- func ContextWithRequestInitFunc(ctx context.Context, initFuncID string, requestInitFunc RequestInitFunc) context.Context
- func CustomBodyCheckFromContext(ctx context.Context, checkID string) check.BodyCustomCheckerFunc
- func RequestBodyReplacements(ctx context.Context, req *http.Request, data map[string]interface{}) (*http.Request, error)
- func RequestHeaderReplacements(ctx context.Context, req *http.Request, data map[string]interface{}) (*http.Request, error)
- func RequestPathReplacements(ctx context.Context, req *http.Request, data map[string]interface{}) (*http.Request, error)
- func RequestQueryReplacements(ctx context.Context, req *http.Request, data map[string]interface{}) (*http.Request, error)
- func RequestReplacements(ctx context.Context, req *http.Request, data map[string]interface{}) (*http.Request, error)
- func Run(ctx context.Context, t *Test, httpClient *http.Client, logger *log.Logger) error
- type RequestInitFunc
- type RunAllArgs
- type RunAllResult
- type Test
Constants ¶
const (
DefaultMaxConcurrentTests = 5
)
Variables ¶
This section is empty.
Functions ¶
func BaseURLFromContext ¶
BaseURLFromContext returns the base URL to be used in tests, as stored in the given context
func ContextWithBaseURL ¶
ContextWithBaseURL stores the given base URL in the context
func ContextWithCustomBodyCheck ¶
func ContextWithCustomBodyCheck(ctx context.Context, checkID string, checkFunc check.BodyCustomCheckerFunc) context.Context
ContextWithCustomBodyCheck stores a BodyCustomCheckerFunc into the context under the given id
func ContextWithRequestInitFunc ¶
func ContextWithRequestInitFunc(ctx context.Context, initFuncID string, requestInitFunc RequestInitFunc) context.Context
ContextWithRequestInitFunc stores a RequestInitFunc into the context under the given id
func CustomBodyCheckFromContext ¶
func CustomBodyCheckFromContext(ctx context.Context, checkID string) check.BodyCustomCheckerFunc
CustomBodyCheckFromContext retrieves a BodyCustomCheckerFunc from the context by id
func RequestBodyReplacements ¶ added in v0.0.6
func RequestBodyReplacements(ctx context.Context, req *http.Request, data map[string]interface{}) (*http.Request, error)
RequestBodyReplacements runs a find and replace in the request body with the given replacements in `data`
func RequestHeaderReplacements ¶ added in v0.0.6
func RequestHeaderReplacements(ctx context.Context, req *http.Request, data map[string]interface{}) (*http.Request, error)
RequestHeaderReplacements runs a find and replace in the request headers with the given replacements in `data`
func RequestPathReplacements ¶ added in v0.0.6
func RequestPathReplacements(ctx context.Context, req *http.Request, data map[string]interface{}) (*http.Request, error)
RequestPathReplacements runs a find and replace in the request url path with the given replacements in `data`
func RequestQueryReplacements ¶ added in v0.0.6
func RequestQueryReplacements(ctx context.Context, req *http.Request, data map[string]interface{}) (*http.Request, error)
RequestQueryReplacements runs a find and replace in the request url query with the given replacements in `data`
Types ¶
type RequestInitFunc ¶
type RequestInitFunc func(ctx context.Context, req *http.Request, data map[string]interface{}) (*http.Request, error)
RequestInitFunc defines the structure of the functions that can be used to initialise a request
func RequestInitFuncFromContext ¶
func RequestInitFuncFromContext(ctx context.Context, initFuncID string) RequestInitFunc
RequestInitFuncFromContext retrieves a RequestInitFunc from the context by id
type RunAllArgs ¶
RunAllArgs defines which arguments are available to give to RunAll
type RunAllResult ¶
RunAllResult is the response given from RunAll
func RunAll ¶
func RunAll(ctx context.Context, args RunAllArgs, tests ...*Test) RunAllResult
RunAll runs the set of given tests
type Test ¶
type Test struct {
// Name is the name of the test
Name string
// Group is the group that the test belongs to
Group string
// Order specified the order in which it will be run. Tests with the same order will be executed at the same time
Order int
// Checks contains all checks contained in this test
Checks []check.Checker
// Request contains the http request being made
Request *http.Request
// Response contains the http response
Response *http.Response
// RequestInitFuncs contains a set of functions used to initialise the request
RequestInitFuncs []RequestInitFunc
// RequestInitFuncsData contains the arguments to be given to the init func with the matching index
RequestInitFuncsData []map[string]interface{}
}
Test defines a test for a single endpoint