Documentation
¶
Index ¶
- func Equal(t *testing.T, testName string, expected interface{}, actual interface{})
- func NotEqual(t *testing.T, testName string, unexpected interface{}, actual interface{})
- func URLValue(t *testing.T, testName string, urlValues url.Values, key, expectedValue string)
- type RequestAssertFunc
- func All(funcs ...RequestAssertFunc) RequestAssertFunc
- func Auth(tokenType string) RequestAssertFunc
- func Body(assertFunc func(t *testing.T, testName string, body string)) RequestAssertFunc
- func BodyFormValue(key, expectedValue string) RequestAssertFunc
- func BodyString(expected string) RequestAssertFunc
- func BodyUnmarshal(object interface{}, assertFunc func(*testing.T, string)) RequestAssertFunc
- func BodyUnmarshalEqual(expected map[string]interface{}) RequestAssertFunc
- func Method(expected string) RequestAssertFunc
- func QueryValue(key, expectedValue string) RequestAssertFunc
- func Unauthed() RequestAssertFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RequestAssertFunc ¶
A RequestAssertFunc takes a request object and makes assertions
func All ¶
func All(funcs ...RequestAssertFunc) RequestAssertFunc
All runs all the assertions in sequence
func Auth ¶
func Auth(tokenType string) RequestAssertFunc
Auth asserts that the right authorization header was put on the request
func Body ¶
func Body(assertFunc func(t *testing.T, testName string, body string)) RequestAssertFunc
Body reads the request's body and checks it's the same as expected
func BodyFormValue ¶
func BodyFormValue(key, expectedValue string) RequestAssertFunc
BodyFormValue returns a RequestAssertFunc that asserts that the body is form-encoded and has the key-value pair given.
func BodyString ¶
func BodyString(expected string) RequestAssertFunc
BodyString returns a RequestAssertFunc that asserts that the request body
func BodyUnmarshal ¶
func BodyUnmarshal(object interface{}, assertFunc func(*testing.T, string)) RequestAssertFunc
BodyUnmarshal returns a RequestAssertFunc that unmarshals the request body into object, then runs assertFunc. Note that assertFunc does not accept an object - this is because it is intended that you write assertFunc as a closure over your object.
func BodyUnmarshalEqual ¶
func BodyUnmarshalEqual(expected map[string]interface{}) RequestAssertFunc
BodyUnmarshalEqual makes a RequestAssertFunc that reads the request body, unmarshals it, and checks the unmarshalled object is equal to expected. Remember that json treats all numbers as float64s! add a .0 to your numbers
func Method ¶
func Method(expected string) RequestAssertFunc
Method reads the request's method and checks that it's the same as expected
func QueryValue ¶
func QueryValue(key, expectedValue string) RequestAssertFunc
QueryValue asserts that the requests' query string has key=value.
func Unauthed ¶
func Unauthed() RequestAssertFunc
Unauthed asserts that the request had no authorization header