test

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRequest

func BuildRequest(s *suite.Suite, method, path string, bodyJSONObj interface{}) *http.Request

BuildRequest used to build a new http request

func ReplaceRequestBody

func ReplaceRequestBody(req *http.Request, oldStr, newStr string) *http.Request

ReplaceRequestBody used to replace request body

Types

type APITest

type APITest struct {
	Requests    []APITestRequest
	Responses   []APITestResponse
	AssertionFn func(*suite.Suite, APITest)
}

APITest used to

func NewAPITest

func NewAPITest(reqs []APITestRequest, assertFn func(*suite.Suite, APITest)) *APITest

NewAPITest used to

func (*APITest) Run

func (ref *APITest) Run(s *suite.Suite, server HTTPServer)

Run used to

type APITestRequest

type APITestRequest struct {
	Request  *http.Request
	PreReqFn func(APITest, *http.Request)
}

APITestRequest used to

type APITestResponse

type APITestResponse struct {
	HeaderMap http.Header
	Code      int
	BodyJSON  interface{}
	BodyText  string
}

APITestResponse used to

func RunRequest

func RunRequest(s *suite.Suite, server HTTPServer, req *http.Request) APITestResponse

RunRequest used to test

type HTTPServer

type HTTPServer interface {
	ServeHTTP(httpwriter http.ResponseWriter, httpRequest *http.Request)
}

HTTPServer used to represent http server

Jump to

Keyboard shortcuts

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