Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
var DefaultServerConfig = server.Configuration{ Address: ":8080", APIPrefix: "/api/test/", APISpecFile: "openapi.json", Debug: true, }
DefaultServerConfig is a default config used by AssertAPIRequest
var ExecuteRequest = helpers.ExecuteRequest
ExecuteRequest executes http request on a testServer
var FailOnError = helpers.FailOnError
FailOnError fails on error
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