tests

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithTimeout

func ContextWithTimeout() (context.Context, context.CancelFunc)

func NewAPI

func NewAPI() (*api.Server, string, routers.Router)

NewAPI builds a new API for testing. Makes a few assumptions about a test database and ports. Check out the code for details. Singleton, ensure your tests are able to run in parallel.

func NewDatabase

func NewDatabase() *database.Database

func ParseJSONBodyWithMap

func ParseJSONBodyWithMap(t *testing.T, body io.ReadCloser) (map[string]interface{}, string)

ParseJSONBodyWithMap parses the body of a JSON response. Returns the data field as map[string]interface{} and the status message as string.

func ParseJSONBodyWithMessage

func ParseJSONBodyWithMessage(t *testing.T, body io.ReadCloser) (string, string)

ParseJSONBodyWithMessage parses the body of a JSON response. Returns the message and the status message as string.

func ParseJSONBodyWithSlice

func ParseJSONBodyWithSlice(t *testing.T, body io.ReadCloser) ([]interface{}, string)

ParseJSONBodyWithSlice parses the body of a JSON response. Returns the data field as map[string]interface{} and the status message as string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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