change: upgrade funplugin to v0.3.0

This commit is contained in:
debugtalk
2022-03-17 16:53:54 +08:00
parent d8fdd9cd95
commit 1ce8d7123a
18 changed files with 6666 additions and 32 deletions

1
examples/__init__.py Normal file
View File

@@ -0,0 +1 @@
# NOTICE: Generated By HttpRunner. DO NOT EDIT!

5
examples/debugtalk.py Normal file
View File

@@ -0,0 +1,5 @@
from plugin.python.plugin import serve
if __name__ == '__main__':
serve()

128
examples/har/demo.json Normal file
View File

@@ -0,0 +1,128 @@
{
"config": {
"name": "testcase description"
},
"teststeps": [
{
"name": "",
"request": {
"method": "GET",
"url": "https://postman-echo.com/get",
"params": {
"foo1": "HDnY8",
"foo2": "34.5"
},
"headers": {
"Accept-Encoding": "gzip",
"Host": "postman-echo.com",
"User-Agent": "HttpRunnerPlus"
}
},
"validate": [
{
"check": "status_code",
"assert": "equals",
"expect": 200,
"msg": "assert response status code"
},
{
"check": "headers.\"Content-Type\"",
"assert": "equals",
"expect": "application/json; charset=utf-8",
"msg": "assert response header Content-Type"
},
{
"check": "body.url",
"assert": "equals",
"expect": "https://postman-echo.com/get?foo1=HDnY8\u0026foo2=34.5",
"msg": "assert response body url"
}
]
},
{
"name": "",
"request": {
"method": "POST",
"url": "https://postman-echo.com/post",
"headers": {
"Accept-Encoding": "gzip",
"Content-Length": "28",
"Content-Type": "application/json; charset=UTF-8",
"Host": "postman-echo.com",
"User-Agent": "Go-http-client/1.1"
},
"cookies": {
"sails.sid": "s%3Az_LpglkKxTvJ_eHVUH6V67drKp0AGWW-.PidabaXOnatLRP47hVyqqepl6BdrpEQzRlJQXtbIiwk"
},
"body": {
"foo1": "HDnY8",
"foo2": 12.3
}
},
"validate": [
{
"check": "status_code",
"assert": "equals",
"expect": 200,
"msg": "assert response status code"
},
{
"check": "headers.\"Content-Type\"",
"assert": "equals",
"expect": "application/json; charset=utf-8",
"msg": "assert response header Content-Type"
},
{
"check": "body.url",
"assert": "equals",
"expect": "https://postman-echo.com/post",
"msg": "assert response body url"
}
]
},
{
"name": "",
"request": {
"method": "POST",
"url": "https://postman-echo.com/post",
"headers": {
"Accept-Encoding": "gzip",
"Content-Length": "20",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Host": "postman-echo.com",
"User-Agent": "Go-http-client/1.1"
},
"cookies": {
"sails.sid": "s%3AS5e7w0zQ0xAsCwh9L8T6R7QLYCO7_gtD.r8%2B2w9IWqEIfuVkrZjnxzm2xADIk34zKAWXRPapr%2FAw"
},
"body": "foo1=HDnY8\u0026foo2=12.3"
},
"validate": [
{
"check": "status_code",
"assert": "equals",
"expect": 200,
"msg": "assert response status code"
},
{
"check": "headers.\"Content-Type\"",
"assert": "equals",
"expect": "application/json; charset=utf-8",
"msg": "assert response header Content-Type"
},
{
"check": "body.data",
"assert": "equals",
"expect": "",
"msg": "assert response body data"
},
{
"check": "body.url",
"assert": "equals",
"expect": "https://postman-echo.com/post",
"msg": "assert response body url"
}
]
}
]
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

51
examples/httpbin.json Normal file
View File

@@ -0,0 +1,51 @@
{
"config": {
"name": "testcase description",
"variables": {},
"verify": false
},
"teststeps": [
{
"name": "/get",
"request": {
"url": "http://httpbin.org/get",
"method": "GET",
"headers": {
"Host": "httpbin.org",
"Connection": "keep-alive",
"accept": "application/json",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36 Edg/98.0.1108.50",
"Referer": "http://httpbin.org/",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"
}
},
"validate": [
{
"check": "status_code",
"assert": "equals",
"expect": 200,
"msg": "assert response status code"
},
{
"check": "headers.\"Content-Type\"",
"assert": "equals",
"expect": "application/json",
"msg": "assert response header Content-Type"
},
{
"check": "body.origin",
"assert": "equals",
"expect": "117.176.133.109",
"msg": "assert response body origin"
},
{
"check": "body.url",
"assert": "equals",
"expect": "http://httpbin.org/get",
"msg": "assert response body url"
}
]
}
]
}

View File

@@ -1,18 +1,18 @@
package main
import (
plugin "github.com/httprunner/func-plugin/go"
"github.com/httprunner/funplugin/fungo"
)
// register functions and build to plugin binary
func main() {
plugin.Register("sum_ints", SumInts)
plugin.Register("sum_two_int", SumTwoInt)
plugin.Register("sum", Sum)
plugin.Register("sum_two_string", SumTwoString)
plugin.Register("sum_strings", SumStrings)
plugin.Register("concatenate", Concatenate)
plugin.Register("setup_hook_example", SetupHookExample)
plugin.Register("teardown_hook_example", TeardownHookExample)
plugin.Serve()
fungo.Register("sum_ints", SumInts)
fungo.Register("sum_two_int", SumTwoInt)
fungo.Register("sum", Sum)
fungo.Register("sum_two_string", SumTwoString)
fungo.Register("sum_strings", SumStrings)
fungo.Register("concatenate", Concatenate)
fungo.Register("setup_hook_example", SetupHookExample)
fungo.Register("teardown_hook_example", TeardownHookExample)
fungo.Serve()
}