tests

package
v0.1.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiScenario

type ApiScenario struct {
	Name           string
	Method         string
	Url            string
	Body           io.Reader
	RequestHeaders map[string]string

	// Delay adds a delay before checking the expectations usually
	// to ensure that all fired non-awaited go routines have finished
	Delay time.Duration

	// expectations
	// ---
	ExpectedStatus  int
	ExpectedContent interface{}

	// test hooks
	// ---
	BeforeRequest func(req *http.Request, server *Server)
	AfterRequest  func(res *http.Response, server *Server)
}

ApiScenario defines a single api request test case/scenario.

type ApiTestCase

type ApiTestCase struct {

	// test hooks
	// ---
	BeforeTestFunc func(t *testing.T, app *Server)
	AfterTestFunc  func(t *testing.T, app *Server)
	// contains filtered or unexported fields
}

func NewTestCase

func NewTestCase(t testing.T, scenarios []ApiScenario, beforeTestFunc, afterTestFunc func(t *testing.T, app *Server)) ApiTestCase

func (*ApiTestCase) Test

func (testCase *ApiTestCase) Test()

Test executes the test case/scenario.

type Server

type Server = api.Server

Jump to

Keyboard shortcuts

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