Commit 2746f191 authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent 5dc81e0a
......@@ -22,7 +22,7 @@ cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
# 设置需要查询的生产厂家
manufacturer = "A"
manufacturer = "B"
# 第二步进行生产厂家模糊查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url7")
request_body = commonFuc().get_business_data(module, "payload7", manufacturer)
......@@ -36,11 +36,18 @@ request_body = commonFuc().get_business_data(module, "payload7", manufacturer)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取查询结果中厂家信息
result = {"data": result["data"][0][0]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict7", manufacturer)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# print(result)
if result["data"]:
# 获取查询结果中厂家信息
result = {"data": result["data"][0][0]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict7", manufacturer)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict7", manufacturer)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
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