testutils

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeJSON

func EncodeJSON(data interface{}) ([]byte, error)

EncodeJSON encodes json data in bytes

func EncodeString added in v1.2.0

func EncodeString(data interface{}) ([]byte, error)

EncodeString encodes string data in bytes

func GetMockArgumentsWithType added in v1.2.0

func GetMockArgumentsWithType(typeString string, num int) []interface{}

Types

type ExpectedResponse

type ExpectedResponse struct {
	StatusCode int
}

ExpectedResponse stores expected response basic data

type HTTPTest

type HTTPTest struct {
	*testing.T
	Encoder func(interface{}) ([]byte, error)
}

HTTPTest encapsulates data for testing needs

func (*HTTPTest) CompareHTTPResponse

func (test *HTTPTest) CompareHTTPResponse(rr *httptest.ResponseRecorder, expected ExpectedResponse)

CompareHTTPResponse compares expected response with actual response

func (*HTTPTest) CreateHTTPRequest

func (test *HTTPTest) CreateHTTPRequest(request Request) *http.Request

CreateHTTPRequest creates http Request with basic data

type Request

type Request struct {
	Method string
	URL    string
	Header http.Header
	Body   interface{}
}

Request stores http Request basic data

Jump to

Keyboard shortcuts

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