Commit 6f8db1ec authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent 76bd6082
......@@ -13,7 +13,6 @@ import json
module = "cmdc_demand_create_pc"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
# print(url)
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
......@@ -21,6 +20,9 @@ password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
# 进行需求单创建操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body = commonFuc().get_business_data(module, "payload")
"""
场景:通过快速下单入口提交创建需求单
......@@ -31,8 +33,15 @@ request_body = commonFuc().get_business_data(module, "payload")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
if result["success"]:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_1")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
\ No newline at end of file
......@@ -65,10 +65,12 @@ with open(file_path, 'wb') as f:
# 获取销售合同文件中合同编号
excel = HandleExcel(file_path, "Sheet1")
result = {"demandCode": excel.read_data()[0].get("医疗器械产品销售合同 ")[5:]}
result = {"demandCode": excel.read_data()[0].get("医疗器械产品销售合同 ")[-17:]}
print(excel.read_data()[0].get("医疗器械产品销售合同 "))
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict22", demand_code)
# print(check_dict)
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
This diff is collapsed.
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