Documentation
¶
Index ¶
- Constants
- func AssertHTTPStatus(t *testing.T, r *httptest.ResponseRecorder, expectedStatus ...int)
- func DecodeError(t *testing.T, s []byte) string
- func DecodeResponse(t *testing.T, r *httptest.ResponseRecorder, target interface{})
- func Request(co controllers.Controller, t *testing.T, method, url string, body any, ...) httptest.ResponseRecorder
- type APIResponse
Constants ¶
View Source
const TOLERANCE time.Duration = 1000000000 * 60
TOLERANCE is the number of seconds that a CreatedAt or UpdatedAt time.Time is allowed to differ from the time at which it is checked.
As CreatedAt and UpdatedAt are automatically set by gorm, we need a tolerance here. This is in nanoseconds, so we multiply by 1000000000 for seconds.
Variables ¶
This section is empty.
Functions ¶
func AssertHTTPStatus ¶ added in v1.0.2
func AssertHTTPStatus(t *testing.T, r *httptest.ResponseRecorder, expectedStatus ...int)
func DecodeResponse ¶ added in v1.0.2
func DecodeResponse(t *testing.T, r *httptest.ResponseRecorder, target interface{})
DecodeResponse decodes an HTTP response into a target struct.
func Request ¶
func Request(co controllers.Controller, t *testing.T, method, url string, body any, headers ...map[string]string) httptest.ResponseRecorder
Request is a helper method to simplify making a HTTP request for tests.
Types ¶
type APIResponse ¶ added in v1.0.2
Click to show internal directories.
Click to hide internal directories.