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

用例优化

parent 01ab7f06
...@@ -14,13 +14,16 @@ import json ...@@ -14,13 +14,16 @@ import json
module = "cmdc_demand_list" module = "cmdc_demand_list"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
# 获取登录所需账号密码 # 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username") username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password") password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token # 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token() cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_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") request_body = commonFuc().get_business_data(module, "payload1")
""" """
...@@ -35,7 +38,7 @@ result = json.loads(result.content) ...@@ -35,7 +38,7 @@ result = json.loads(result.content)
# print(result) # print(result)
# 获取预期结果 # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2") check_dict = commonFuc().get_business_data(module, "checkDict2")
print(check_dict) # print(check_dict)
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
...@@ -59,6 +59,6 @@ result = json.loads(result.content) ...@@ -59,6 +59,6 @@ result = json.loads(result.content)
# print(result) # print(result)
# 获取预期结果 # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict4") check_dict = commonFuc().get_business_data(module, "checkDict4")
print(check_dict) # print(check_dict)
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
...@@ -53,6 +53,6 @@ result = json.loads(result.content) ...@@ -53,6 +53,6 @@ result = json.loads(result.content)
# print(result) # print(result)
# 获取预期结果 # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict3") check_dict = commonFuc().get_business_data(module, "checkDict3")
print(check_dict) # print(check_dict)
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
...@@ -13,8 +13,11 @@ import json ...@@ -13,8 +13,11 @@ import json
module = "cmdc_demand_list" module = "cmdc_demand_list"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1") # 获取已失效的token
headers = commonFuc().get_business_data(module, "json_headers") headers = commonFuc().get_business_data(module, "json_headers")
# 获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload") request_body = commonFuc().get_business_data(module, "payload")
""" """
...@@ -29,6 +32,6 @@ result = json.loads(result.content) ...@@ -29,6 +32,6 @@ result = json.loads(result.content)
# print(result) # print(result)
# 获取预期结果 # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict1") check_dict = commonFuc().get_business_data(module, "checkDict1")
print(check_dict) # print(check_dict)
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
\ No newline at end of file
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