spec

package
v0.0.0-...-5ddb3d2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertHTTPAPISpec

func AssertHTTPAPISpec(t *testing.T, baseURL, specPackagePath string)

AssertHTTPAPISpec runs a test suite of HTTP requests against the given base URL to assert it conforms to the affix core API specification. Spec is defined in the "open_api_3.yaml" file in the api package

Types

type Response

type Response struct {
	Code    int
	Headers map[string]string
}

Response holds the expected HTTP response

type SkipList

type SkipList []string

SkipList holds a list of endpoints for which to skip testing

type TestCase

type TestCase struct {
	Endpoint string            // API endpoint to test
	Method   string            // HTTP request method, defaults to "GET"
	Params   map[string]string // Request query or path parameters
	Headers  map[string]string // Request HTTP headers
	Body     interface{}       // request body
	Expect   *Response         // Assertions about the response
}

TestCase is a single request-response round trip to the API with parameters for constructing the request & expectations for assessing the response.

Jump to

Keyboard shortcuts

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