Commit ad460bff authored by liguangyu06's avatar liguangyu06
Browse files

需求单创建接口用例优化

parent 94032d3f
......@@ -11,11 +11,9 @@ from air_case.cmdc_login.多彩商城登录.多彩商城登录 import CmdcMaiiLo
import requests
import json
module = "cmdc_demand_create_pc"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
......@@ -23,9 +21,9 @@ password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1",cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
request_body = commonFuc().get_business_data(module, "payload1")
request_body = commonFuc().get_business_data(module, "payload")
print(request_body)
"""
场景:通过快速下单入口提交创建需求单
......@@ -37,7 +35,7 @@ result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict1")
check_dict = commonFuc().get_business_data(module, "checkDict")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -4,15 +4,15 @@
#需求单创建接口地址
"url1": "/order/public/saveAllDemandOrder"
"url": "/order/public/saveAllDemandOrder"
#测试场景:需求单创建
json_headers1: {
json_headers: {
"Cmdc_access_token": "%s",
"Sourcetype": "mall"
}
"payload1": {
"payload": {
"国药集团联合医疗器械有限公司": {
"datas": [
{
......@@ -1387,7 +1387,12 @@ json_headers1: {
}
}
#预期结果
checkDict1: {"success":true,"code":"200","message":null}
checkDict: {"success":true,"code":"200","message":null}
#参数化
#商品列表接口地址
"url1": "/product/public/totalListQuickOrderProduct"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment