Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BodyMatcherIgnore = []string{
"organization",
"organization_id",
"project_id",
"project",
"name",
"expires_at",
"password",
"mnq_project_id",
"mnq_region",
"mnq_nats_account_id",
"mnq_nats_subject",
}
BodyMatcherIgnore contains the list of json body keys that should be ignored when matching requests with cassettes
var QueryMatcherIgnore = []string{
"organization_id",
"project_id",
"start",
"end",
}
QueryMatcherIgnore contains the list of query value that should be ignored when matching requests with cassettes
Functions ¶
func CassetteMatcher ¶
CassetteMatcher is a custom matcher that checks equivalence of a played request against a recorded one It compares method, path and query but will remove unwanted values from query
func NewHTTPRecorder ¶
func NewHTTPRecorder( t *testing.T, pkgFolder string, update bool, realTransport http.RoundTripper, additionalHooks ...AdditionalHook, ) (*recorder.Recorder, error)
NewHTTPRecorder creates a new httpClient that records all HTTP requests in a cassette. This cassette is then replayed whenever tests are executed again. This means that once the requests are recorded in the cassette, no more real HTTP requests must be made to run the tests.
It is important to add a `defer cleanup()` so the given cassette files are correctly closed and saved after the requests.