Commit 9b33dd34 authored by liguangyu06's avatar liguangyu06
Browse files

用例优化

parent f5caafc0
...@@ -15,7 +15,7 @@ import random ...@@ -15,7 +15,7 @@ import random
module = "cmdc_demand_delete" module = "cmdc_demand_delete"
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(10000000000000, 1000000000000000) demand_id = random.randint(10000000000000, 1000000000000000)
# 进行需求单的删除
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body = commonFuc().get_business_data(module, "payload2", demand_id) request_body = commonFuc().get_business_data(module, "payload2", demand_id)
""" """
......
...@@ -51,7 +51,7 @@ if result["code"] == "200": ...@@ -51,7 +51,7 @@ if result["code"] == "200":
# print(result1) # print(result1)
# 获取demandId # 获取demandId
demand_id = result1["data"]["list"][0]["demandId"] demand_id = result1["data"]["list"][0]["demandId"]
print(demand_id) # print(demand_id)
# 第三步删除操作 # 第三步删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
...@@ -67,7 +67,7 @@ if result["code"] == "200": ...@@ -67,7 +67,7 @@ if result["code"] == "200":
# 发送请求 # 发送请求
result = requests.post(url, json=request_body, headers=headers) result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content) 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")
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
......
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