base

package module
v0.0.0-...-d38e92d Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

README

go-httptest

http 单元测试的简单封装

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IdKeys = ResponseKeys{
	{Type: "uint", Key: "id", Value: uint(0)},
}
View Source
var PageKeys = ResponseKeys{
	{Type: "int", Key: "pageSize", Value: 10},
	{Type: "int", Key: "page", Value: 1},
	{Type: "int", Key: "total", Value: 0},
}

PageKeys 基础分页请求返回参数

View Source
var PageRes = map[string]interface{}{"page": 1, "pageSize": 10}

PageRes 基础分页请求参数

Functions

func Create

func Create(auth *httpexpect.Expect, url string, create map[string]interface{}, keys ResponseKeys) *httpexpect.Object

Create 创建数据 auth 授权后的 *httpexpect.Expect url 请求地址 create 请求数据 keys 响应数据

func Delete

func Delete(auth *httpexpect.Expect, url string, keys ResponseKeys)

Delete 删除数据 auth 授权后的 *httpexpect.Expect url 请求地址 keys 响应数据

func DeleteMutil

func DeleteMutil(auth *httpexpect.Expect, url string, data map[string]interface{}, keys ResponseKeys)

DeleteMutil 批量删除数据 auth 授权后的 *httpexpect.Expect url 请求地址 data 请求数据 keys 响应数据

func Get

func Get(auth *httpexpect.Expect, url string, keys ResponseKeys)

Get 获取数据 auth 授权后的 *httpexpect.Expect url 请求地址 keys 响应数据

func GetList

func GetList(auth *httpexpect.Expect, url string, keys ResponseKeys)

GetList 分页请求-get auth 授权后的 *httpexpect.Expect url 请求地址 keys 响应数据

func Post

func Post(auth *httpexpect.Expect, url string, data map[string]interface{}, keys ResponseKeys)

Post 提交数据 auth 授权后的 *httpexpect.Expect url 请求地址 data 请求数据 keys 响应数据

func PostList

func PostList(auth *httpexpect.Expect, url string, res map[string]interface{}, pageKeys ResponseKeys)

PostList 分页请求-post auth 授权后的 *httpexpect.Expect url 请求地址 res 请求参数 pageKeys 相应数据

func Update

func Update(auth *httpexpect.Expect, url string, update map[string]interface{}, keys ResponseKeys)

Update 更新数据 auth 授权后的 *httpexpect.Expect url 请求地址 update 请求数据 keys 响应数据

Types

type Param

type Param struct {
	Name         string
	Args         map[string]interface{}
	ResponseKeys ResponseKeys
}

type ResponseKey

type ResponseKey struct {
	Type  string
	Key   string
	Value interface{}
}

type ResponseKeys

type ResponseKeys []ResponseKey

func (ResponseKeys) GetId

func (rks ResponseKeys) GetId() uint

func (ResponseKeys) GetStringValue

func (rks ResponseKeys) GetStringValue(key string) string

func (ResponseKeys) GetUintValue

func (rks ResponseKeys) GetUintValue(key string) uint

func (ResponseKeys) Keys

func (rks ResponseKeys) Keys() []string

func (ResponseKeys) Scan

func (rks ResponseKeys) Scan(object *httpexpect.Object)

func (ResponseKeys) Test

func (rks ResponseKeys) Test(object *httpexpect.Object)

Jump to

Keyboard shortcuts

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