Documentation ¶
Overview ¶
Package apitest provides few tools helping you write tests
Index ¶
- func AssertError(t *testing.T, expect jsonapi.Error, data interface{}, err error) jsonapi.Error
- func Modify(f func(jsonapi.Request) jsonapi.Request) jsonapi.Middleware
- func Monitor(f func(jsonapi.Request, interface{}, error)) jsonapi.Middleware
- func NewRequest(method, target string, data interface{}) *http.Request
- type Test
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertError ¶
AssertError validates if returned values is specified error value
It checks for following situations:
- data must be nil
- err must be jsonapi.Error type
- expect.EqualTo(err) == true
func Monitor ¶
func Monitor(f func(jsonapi.Request, interface{}, error)) jsonapi.Middleware
Monitor creates a middleware that do some magic after running handler
func NewRequest ¶
NewRequest wraps httptest.NewRequest, use your data (encoded to JSON) as request body
It also sets "Content-Type" to "application/json".
Types ¶
Click to show internal directories.
Click to hide internal directories.