Commit f640d958 authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent 6c81b80d
......@@ -15,13 +15,15 @@ import json
module = "cmdc_demand_list_pc"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
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_headers1", cmdc_access_token)
# 获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
"""
......@@ -36,6 +38,6 @@ result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict1")
print(check_dict)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -20,12 +20,14 @@ 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)
# 获取需求单列表查询待客户确认需求单
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload50")
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取需求单信息
demand_parent_id = result["data"]["list"][0]["demandParentId"]
demand_id = result["data"]["list"][0]["demandId"]
......@@ -44,6 +46,6 @@ result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict5")
print(check_dict)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -20,12 +20,14 @@ 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)
# 获取需求单列表查询待客户确认需求单
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload40")
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取需求单信息
demand_parent_id = result["data"]["list"][0]["demandParentId"]
demand_id = result["data"]["list"][0]["demandId"]
......@@ -44,6 +46,6 @@ result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict4")
print(check_dict)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -52,6 +52,5 @@ result = json.loads(result.content)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict3")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -26,6 +26,8 @@ request_body = commonFuc().get_business_data(module, "payload20")
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取到需求单信息
demand_code = result["data"]["list"][0]["demandCode"]
# 获取需求单进行取消操作
......@@ -43,6 +45,6 @@ result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2")
print(check_dict)
# 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