Commit 01ab7f06 authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent 9b33dd34
...@@ -15,7 +15,7 @@ import random ...@@ -15,7 +15,7 @@ import random
module = "cmdc_demand_fail" module = "cmdc_demand_fail"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
# 获取登录所需账号密码 # 获取登录所需账号密码
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")
...@@ -24,6 +24,9 @@ cmdc_access_token = CmdcDoLogin(username, password).get_token() ...@@ -24,6 +24,9 @@ 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)
# 随机生成不存在的需求单id # 随机生成不存在的需求单id
demand_id = random.randint(100000000000, 100000000000000) demand_id = random.randint(100000000000, 100000000000000)
# 进行需求单的审核处理
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body = commonFuc().get_business_data(module, "payload3", demand_id) request_body = commonFuc().get_business_data(module, "payload3", demand_id)
""" """
...@@ -38,6 +41,6 @@ result = json.loads(result.content) ...@@ -38,6 +41,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)
...@@ -31,6 +31,7 @@ result = requests.post(url1, json=request_body, headers=headers) ...@@ -31,6 +31,7 @@ result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content) result = json.loads(result.content)
# 获取demandId # 获取demandId
demand_id = result["data"]["list"][0]["demandId"] demand_id = result["data"]["list"][0]["demandId"]
# 第三步进行审核操作 # 第三步进行审核操作
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url") url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body1 = commonFuc().get_business_data(module, "payload4", demand_id) request_body1 = commonFuc().get_business_data(module, "payload4", demand_id)
...@@ -47,6 +48,6 @@ result1 = json.loads(result1.content) ...@@ -47,6 +48,6 @@ result1 = json.loads(result1.content)
# print(result1) # print(result1)
# 获取预期结果 # 获取预期结果
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, result1) commonFuc().check_result(check_dict, result1)
...@@ -53,6 +53,6 @@ result3 = json.loads(result3.content) ...@@ -53,6 +53,6 @@ result3 = json.loads(result3.content)
# print(result3) # print(result3)
# 获取预期结果 # 获取预期结果
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, result3) commonFuc().check_result(check_dict, result3)
...@@ -46,6 +46,6 @@ result1 = json.loads(result1.content) ...@@ -46,6 +46,6 @@ result1 = json.loads(result1.content)
# print(result1) # print(result1)
# 获取预期结果 # 获取预期结果
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, result1) commonFuc().check_result(check_dict, result1)
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