echotest

package
v0.9.21 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do added in v0.9.1

func Do(handler echo.HandlerFunc, req *http.Request, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

Do request against the handler

func DoDELETE

func DoDELETE(handler echo.HandlerFunc, url string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

DoDELETE return echo.Context and httptest.ResponseRecorder for DELETE Request (deprecated)

func DoGET

func DoGET(handler echo.HandlerFunc, url string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

DoGET return recorder and error for GET API (deprecated)

func DoPATCH added in v0.9.1

func DoPATCH(handler echo.HandlerFunc, url string, json string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

DoPATCH return echo.Context and httptest.ResponseRecorder for PUT Request (deprecated)

func DoPOST

func DoPOST(handler echo.HandlerFunc, url string, json string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

DoPOST return echo.Context and httptest.ResponseRecorder for POST Request (deprecated)

func DoPUT

func DoPUT(handler echo.HandlerFunc, url string, json string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error)

DoPUT return echo.Context and httptest.ResponseRecorder for PUT Request (deprecated)

func EqualResp added in v0.9.9

func EqualResp(t *testing.T, expected Response, rec *httptest.ResponseRecorder)

EqualResp expect response

Types

type Request added in v0.8.30

type Request struct {
	Method    string
	Target    string
	Body      string
	Header    http.Header
	URLParams map[string]string
}

Request for testcase

func (*Request) Request added in v0.9.9

func (r *Request) Request() *http.Request

Request return http request

type Response added in v0.9.0

type Response struct {
	Code   int
	Header http.Header
	Body   string
}

Response that expected

type TestCase added in v0.8.30

type TestCase struct {
	Request          Request
	ExpectedResponse Response
	ExpectedError    string
}

TestCase for echo

func (*TestCase) Execute added in v0.8.30

func (tt *TestCase) Execute(t *testing.T, fn echo.HandlerFunc)

Execute test case against handle function

Jump to

Keyboard shortcuts

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