test

package
v0.44.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

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

func AssertHTTPStatus(t *testing.T, expected int, r *httptest.ResponseRecorder)

func DecodeError

func DecodeError(t *testing.T, s []byte) string

func DecodeResponse

func DecodeResponse(t *testing.T, r *httptest.ResponseRecorder, target interface{})

DecodeResponse decodes an HTTP response into a target struct.

func Request

func Request(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

type APIResponse struct {
	Links map[string]string
	Error string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL