Documentation ¶
Index ¶
- type Check
- type RequestModifier
- type ResponseAssertion
- type TestConfig
- type TestOption
- func After(check Check) TestOption
- func Before(check Check) TestOption
- func RequestBody(body string) TestOption
- func RequestHeader(header string, value string) TestOption
- func RequestJSON(d interface{}) TestOption
- func RequestMethod(method string) TestOption
- func RequestRel(rel string) TestOption
- func ResponseBody(expectedBody string) TestOption
- func ResponseCookie(name string, value string) TestOption
- func ResponseHeader(header string, expected string) TestOption
- func ResponseJsonField(field string, expected interface{}) TestOption
- func ResponseJsonFieldMatcher(field string, matcher func(t *testing.T, actual interface{})) TestOption
- func ResponseJsonFieldPattern(field string, pattern string) TestOption
- func ResponseStatus(expectedStatus int) TestOption
- type TestSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RequestModifier ¶
type ResponseAssertion ¶
type ResponseAssertion func(*testing.T, *httptest.ResponseRecorder)
type TestConfig ¶
type TestConfig struct {
// contains filtered or unexported fields
}
func Test ¶
func Test(name string, options ...TestOption) TestConfig
Test creates a single test object
type TestOption ¶
type TestOption func(*TestConfig)
func After ¶
func After(check Check) TestOption
func Before ¶
func Before(check Check) TestOption
func RequestHeader ¶
func RequestHeader(header string, value string) TestOption
RequestHeader sets a specific header on the request
func RequestJSON ¶
func RequestJSON(d interface{}) TestOption
RequestJSON sets the body and the correct content type for a request
func RequestMethod ¶
func RequestMethod(method string) TestOption
RequestMethod sets the method for the request
func RequestRel ¶
func RequestRel(rel string) TestOption
RequestRel sets the relative url for the request (i.e. "/abc")
func ResponseBody ¶
func ResponseBody(expectedBody string) TestOption
ResponseBody asserts that the response received has the expected body
func ResponseCookie ¶
func ResponseCookie(name string, value string) TestOption
ResponseCookie asserts that the response received has a specific cookie
func ResponseHeader ¶
func ResponseHeader(header string, expected string) TestOption
ResponseHeader asserts that the response received has the expected header
func ResponseJsonField ¶
func ResponseJsonField(field string, expected interface{}) TestOption
ResponseJsonField asserts that a specific JSON field has a specific value
func ResponseJsonFieldMatcher ¶
func ResponseJsonFieldMatcher(field string, matcher func(t *testing.T, actual interface{})) TestOption
ResponseJsonFieldMatcher is a looser version which provides a more primitive assertion
func ResponseJsonFieldPattern ¶
func ResponseJsonFieldPattern(field string, pattern string) TestOption
ResponseJsonFieldPattern asserts that a specific JSON field matches a regular expression string
func ResponseStatus ¶
func ResponseStatus(expectedStatus int) TestOption
ResponseStatus asserts that the response received has the expected status