test

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoLogin

func AutoLogin(id int) (map[string]interface{}, error)

AutoLogin auto login

func Clean

func Clean()

Clean the test environment

func GuardBearerJWT

func GuardBearerJWT(c *gin.Context)

GuardBearerJWT test guard

func Port

func Port(t *testing.T) int

Port Get the test server port

func Prepare

func Prepare(t *testing.T, cfg config.Config)

Prepare test environment

func Start

func Start(t *testing.T, guards map[string]gin.HandlerFunc, cfg config.Config)

Start the test server

func Stop

func Stop()

Stop the test server

Types

type Request

type Request struct {
	// contains filtered or unexported fields
}

Request request

func NewRequest

func NewRequest(port int) *Request

NewRequest create a new request

func (*Request) Data

func (r *Request) Data(data map[string]interface{}) *Request

Data set data

func (*Request) Get

func (r *Request) Get() (*Response, error)

Get request

func (*Request) Header

func (r *Request) Header(key string, value string) *Request

Header set header

func (*Request) Param

func (r *Request) Param(key string, value string) *Request

Param set saram

func (*Request) Post

func (r *Request) Post() (*Response, error)

Post request

func (*Request) Route

func (r *Request) Route(route string) *Request

Route set the route

func (*Request) Send

func (r *Request) Send() (*Response, error)

Send request

func (*Request) Token

func (r *Request) Token(token string) *Request

Token set token

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response response

func (*Response) Body

func (p *Response) Body() string

Body get the reaponse body

func (*Response) Int

func (p *Response) Int() (int, error)

Int to int

func (*Response) Map

func (p *Response) Map() (map[string]interface{}, error)

Map to map

func (*Response) Status

func (p *Response) Status() int

Status get the reaponse status

func (*Response) To

func (p *Response) To(v interface{}) error

To cast to custom sturct

Jump to

Keyboard shortcuts

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