testlib

package
v0.0.0-...-0964dd4 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestExecutor

type TestExecutor struct {
	R *gin.Engine
	W *httptest.ResponseRecorder
}

func Initiate

func Initiate() TestExecutor

func (TestExecutor) CheckBody

func (te TestExecutor) CheckBody(body []byte, storedData map[string]interface{}) []byte

func (TestExecutor) CheckHeader

func (te TestExecutor) CheckHeader(header map[string]string, storedData map[string]interface{})

func (TestExecutor) Execute

func (te TestExecutor) Execute(req *http.Request) TestValidator

func (*TestExecutor) Flush

func (te *TestExecutor) Flush()

func (TestExecutor) MakeRequest

func (te TestExecutor) MakeRequest(method string, url string, body []byte) (*http.Request, error)

func (TestExecutor) SetHeader

func (te TestExecutor) SetHeader(req *http.Request, header map[string]string)

func (TestExecutor) SetParams

func (te TestExecutor) SetParams(url string, params map[string]string) string

type TestResponse

type TestResponse struct {
	StatusCode int
	Body       []byte
}

func (TestResponse) ParseBody

func (tr TestResponse) ParseBody() (map[string]interface{}, error)

func (TestResponse) RetrieveValueFromBody

func (tr TestResponse) RetrieveValueFromBody(key string, body interface{}) interface{}

type TestValidator

type TestValidator struct {
	Response TestResponse
}

func (TestValidator) ExpectBody

func (tv TestValidator) ExpectBody(t *testing.T, body map[string]interface{})

func (TestValidator) ExpectNotNilAndSave

func (tv TestValidator) ExpectNotNilAndSave(t *testing.T, key string) interface{}

func (TestValidator) ExpectResponseStatus

func (tv TestValidator) ExpectResponseStatus(t *testing.T, status string)

func (TestValidator) ExpectValueEqual

func (tv TestValidator) ExpectValueEqual(t *testing.T, expected interface{}, actual interface{})

func (TestValidator) ExpectValueNotEqual

func (tv TestValidator) ExpectValueNotEqual(t *testing.T, expected interface{}, actual interface{})

Jump to

Keyboard shortcuts

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