Commit 009798efe567ce8c06a285778b0e1c9da61a5e72

Authored by yangfan
1 parent a544f514

初步搭建

from requests_toolbelt import MultipartEncoder
import requests
def get_data(name,phone,map_address,longPoint,latPoint,filePath,imagePath):
m = MultipartEncoder(
fields={
'name': name,
'phone': phone,
'map_address': map_address,
'long': longPoint,
'lat': latPoint,
'file': ('file', open(filePath, 'rb'), 'image/jpeg'),
'image': ('image', open(imagePath, 'rb'), 'image/jpeg')
}
)
return m
def get_content_type(data):
return data.content_type
... ...
- config:
name: "商家服务"
request:
base_url: http://dc1.colorcun.com:10005?s=
- test:
name: 添加商家信息
variable_binds:
- name: "测试店"
- phone: "18044499"
- map_address: "陕西省西安市"
- long: "123"
- lat: "456"
- file: "/Users/orange/cover.jpeg"
- image: "/Users/orange/cover.jpeg"
- multipart_encoder: ${get_data($name,$phone,$map_address,$long,$lat,$file,$image)}
request:
url: App.Seller.AddSeller
method: POST
headers:
Content-Type: ${get_content_type($multipart_encoder)}
data: $multipart_encoder
validate:
- eq: ["content.ret", 200]
- test:
name: 获取商家列表数据
request:
url: App.Seller.SellerLists
method: POST
data:
page: "PhalApi"
validate:
- eq: ["content.ret", 200]
- test:
name: 根据商家ID获取商家信息
request:
url: App.Seller.GetSellerById
method: POST
data:
sellerid: 5
validate:
- eq: ["content.ret", 200]
- test:
name: 根据商家ID修改商家信息
request:
url: App.Seller.GetSellerById
method: POST
validate:
- eq: ["content.ret", 200]
... ...
- config:
name: "打印服务"
request:
base_url: http://dc1.colorcun.com:10005?s=
- test:
name: 获取商家列表数据
request:
url: App.Prints.SellerLists
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 根据商家ID修改商家信息
request:
url: App.Prints.GetSeller
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 根据商家ID获取商家信息
request:
url: App.Prints.GetSellerById
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 根据商家ID修改商家信息
request:
url: App.Prints.SetSellerById
method: POST
validate:
- eq: ["content.ret", 200]
\ No newline at end of file
... ...
- config:
name: "桌位服务"
request:
base_url: http://dc1.colorcun.com:10005?s=
- test:
name: 添加商家桌位信息
request:
url: App.Tables.AddTable
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 添加商家桌位区域
request:
url: App.Tables.AddTableRegion
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 生成桌位小程序二维码
request:
url: App.Tables.CreateQrcodeByTable
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 修改商家桌位区域
request:
url: App.Tables.SetTableRegionById
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 获取商家桌位列表数据
request:
url: App.Tables.GetTableListsBySellerId
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 修改桌位信息
request:
url: App.Tables.SetTableById
method: POST
validate:
- eq: ["content.ret", 200]
\ No newline at end of file
... ...
- config:
name: "菜品服务"
request:
base_url: http://dc1.colorcun.com:10005?s=
- test:
name: 添加菜品信息
request:
url: App.Cookbook.AddCookbook
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 添加菜品分类
request:
url: App.Cookbook.AddCookbookClass
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 删除菜品分类
request:
url: App.Cookbook.DelCookbookClassById
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 获取分类下所有菜品
request:
url: App.Cookbook.GetCookbookByClassId
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 获取单个菜品信息
request:
url: App.Cookbook.GetCookbookById
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 获取商家下所有菜品
request:
url: App.Cookbook.GetCookbookBySellerId
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 获取菜品分类
request:
url: App.Cookbook.GetCookbookClassBySellerId
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 修改单个菜品信息
request:
url: App.Cookbook.SetCookbookById
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 修改菜品分类
request:
url: App.Cookbook.SetCookbookClassById
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 修改单个菜品排序
request:
url: App.Cookbook.SetCookbookOrderById
method: POST
validate:
- eq: ["content.ret", 200]
\ No newline at end of file
... ...
- config:
name: "菜谱服务"
request:
base_url: http://dc1.colorcun.com:10005?s=
- test:
name: 添加菜谱
request:
url: App.Menu.AddMenu
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 根据菜谱ID获取关联菜品
request:
url: App.Menu.GetCookBookByMenuId
method: POST
validate:
- eq: ["content.ret", 200]
- test:
name: 根据菜谱ID获取关联菜品数量
request:
url: App.Menu.GetCookBookNumByMenuId
method: POST
data:
sellerid: 5
validate:
- eq: ["content.ret", 200]
- test:
name: 根据菜谱ID获取菜谱基本信息
request:
url: App.Menu.GetMenuById
method: POST
data:
sellerid: 5
validate:
- eq: ["content.ret", 200]
- test:
name: 根据商家ID获取菜谱信息
request:
url: App.Menu.GetMenuLists
method: POST
data:
sellerid: 5
validate:
- eq: ["content.ret", 200]
- test:
name: 根据菜谱ID修改菜谱信息
request:
url: App.Menu.SetMenuById
method: POST
data:
sellerid: 5
validate:
- eq: ["content.ret", 200]
\ No newline at end of file
... ...