helpers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CheckResponseBodyJSON = helpers.CheckResponseBodyJSON

CheckResponseBodyJSON checks if body is the same json as in expected (ignores whitespaces, newlines, etc) also validates both expected and body to be a valid json

View Source
var DefaultServerConfig = server.Configuration{
	Address:     ":8080",
	APIPrefix:   "/api/test/",
	APISpecFile: "openapi.json",
	Debug:       true,
}

DefaultServerConfig is a default config used by AssertAPIRequest

View Source
var ExecuteRequest = helpers.ExecuteRequest

ExecuteRequest executes http request on a testServer

View Source
var FailOnError = helpers.FailOnError

FailOnError fails on error

View Source
var RunTestWithTimeout = helpers.RunTestWithTimeout

RunTestWithTimeout runs test with a provided timeout

Functions

func AssertAPIRequest

func AssertAPIRequest(
	t testing.TB,
	serverConfig *server.Configuration,
	request *APIRequest,
	expectedResponse *APIResponse,
)

AssertAPIRequest creates new server (which you can keep nil so it will be created automatically) and provided serverConfig(you can leave it empty to use the default one) sends api request and checks api response (see docs for APIRequest and APIResponse)

Types

type APIRequest

type APIRequest = helpers.APIRequest

APIRequest is a request to api to use in AssertAPIRequest

type APIResponse

type APIResponse = helpers.APIResponse

APIResponse is an expected api response to use in AssertAPIRequest

Jump to

Keyboard shortcuts

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