Commit e7e2bda7 authored by 李光宇's avatar 李光宇
Browse files

Merge branch 'master' into 'main'

Master|更新商品模块和订单逆向模块用例

See merge request !5
parents ffa18436 8fa1e69c
...@@ -15,8 +15,8 @@ module = "cmdc_coupon" ...@@ -15,8 +15,8 @@ module = "cmdc_coupon"
# 第一步登录后台运营平台获取cmdc_access_token # 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码 # 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username3") username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password3") password = commonFuc().get_business_data(module, "password1")
# 获取登录后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_headers", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
...@@ -27,7 +27,7 @@ request_body = commonFuc().get_business_data(module, "payload9") ...@@ -27,7 +27,7 @@ request_body = commonFuc().get_business_data(module, "payload9")
# 发送请求 # 发送请求
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)
# 查询优惠券活动id # 查询优惠券活动id
coupon_id = result["data"]["list"][0]["couponId"] coupon_id = result["data"]["list"][0]["couponId"]
...@@ -44,6 +44,7 @@ request_body = commonFuc().get_business_data(module, "payload10", coupon_id) ...@@ -44,6 +44,7 @@ request_body = commonFuc().get_business_data(module, "payload10", coupon_id)
# 发送请求 # 发送请求
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)
# 获取商品对应的优惠券id
result = {"couponId": result["data"][0]["couponId"]} result = {"couponId": result["data"][0]["couponId"]}
# 获取预期结果 # 获取预期结果
......
...@@ -15,8 +15,8 @@ module = "cmdc_coupon" ...@@ -15,8 +15,8 @@ module = "cmdc_coupon"
# 第一步登录后台运营平台获取cmdc_access_token # 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码 # 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username3") username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password3") password = commonFuc().get_business_data(module, "password1")
# 获取登录后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_headers", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
...@@ -57,9 +57,12 @@ request_body = commonFuc().get_business_data(module, "payload11", product_id, co ...@@ -57,9 +57,12 @@ request_body = commonFuc().get_business_data(module, "payload11", product_id, co
# 发送请求 # 发送请求
result = requests.get(url, params=request_body, headers=headers) result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content) result = json.loads(result.content)
result = {"couponId": result["data"]["couponList"][0]["couponId"]} # print(result)
for i in result["data"]["couponList"]:
# 获取预期结果 if i["couponId"] == coupon_id:
check_dict = commonFuc().get_business_data(module, "checkDict10", coupon_id) # 获取商品对应优惠券id
# 断言实际结果中是否包含预期结果的内容 result = {"couponId": i["couponId"]}
commonFuc().check_result(check_dict, result) # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict10", coupon_id)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
...@@ -28,24 +28,16 @@ request_body1 = commonFuc().get_business_data(module, "payload10") ...@@ -28,24 +28,16 @@ request_body1 = commonFuc().get_business_data(module, "payload10")
# 发送请求 # 发送请求
result1 = requests.post(url1, json=request_body1, headers=headers1) result1 = requests.post(url1, json=request_body1, headers=headers1)
result1 = json.loads(result1.content) result1 = json.loads(result1.content)
# print(result1)
# 获取预期结果
check_dict1 = commonFuc().get_business_data(module, "checkDict10")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict1, result1)
# 获取新创建需求单对应的订单编号 # 获取新创建需求单对应的订单编号
order_num = result1["data"]["国药集团北京医疗器械有限公司"]["demandItems"][0]["demandCode"] order_num = result1["data"]["国药集团北京医疗器械有限公司"]["demandItems"][0]["demandCode"]
# print(order_num)
# 第三步在需求单列表根据订单编号查询出新创建的需求单 # 第三步在需求单列表根据订单编号查询出新创建的需求单
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url20") url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url20")
request_body2 = commonFuc().get_business_data(module, "payload20", order_num) request_body2 = commonFuc().get_business_data(module, "payload20", order_num)
# 发送请求 # 发送请求
result2 = requests.post(url2, json=request_body2, headers=headers1) result2 = requests.post(url2, json=request_body2, headers=headers1)
result2 = json.loads(result2.content) result2 = json.loads(result2.content)
# 获取预期结果
check_dict2 = commonFuc().get_business_data(module, "checkDict2")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict2, result2)
# 第四步获取到新增需求单对应的id并进行参数化赋值处理 # 第四步获取到新增需求单对应的id并进行参数化赋值处理
demand_code = result2["data"]["list"][0]["demandCode"] demand_code = result2["data"]["list"][0]["demandCode"]
...@@ -56,11 +48,6 @@ request_body3 = commonFuc().get_business_data(module, "payload30", demand_code) ...@@ -56,11 +48,6 @@ request_body3 = commonFuc().get_business_data(module, "payload30", demand_code)
# 发送请求 # 发送请求
result3 = requests.post(url3, json=request_body3, headers=headers1) result3 = requests.post(url3, json=request_body3, headers=headers1)
result3 = json.loads(result3.content) result3 = json.loads(result3.content)
# print(result3)
# 获取预期结果
check_dict3 = commonFuc().get_business_data(module, "checkDict30")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict3, result3)
""" """
场景:流程验证-快速下单创建-申请取消-审核 场景:流程验证-快速下单创建-申请取消-审核
...@@ -68,7 +55,6 @@ commonFuc().check_result(check_dict3, result3) ...@@ -68,7 +55,6 @@ commonFuc().check_result(check_dict3, result3)
""" """
# 步骤六在后台运营系统查询出用户提交取消申请 # 步骤六在后台运营系统查询出用户提交取消申请
# 登录后台运营系统获取token信息 # 登录后台运营系统获取token信息
# 获取登录多采商城所需账号密码
username = commonFuc().get_business_data(module, "username1") username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1") password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token并进行参数化赋值 # 获取登录后Cmdc_access_token并进行参数化赋值
...@@ -80,24 +66,31 @@ request_body4 = commonFuc().get_business_data(module, "payload83", demand_code) ...@@ -80,24 +66,31 @@ request_body4 = commonFuc().get_business_data(module, "payload83", demand_code)
# 发送请求 # 发送请求
result4 = requests.post(url4, json=request_body4, headers=headers) result4 = requests.post(url4, json=request_body4, headers=headers)
result4 = json.loads(result4.content) result4 = json.loads(result4.content)
# print(result4)
# 获取预期结果
check_dict4 = commonFuc().get_business_data(module, "checkDict83")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict4, result4)
# 获取demandid # 获取demandid
demand_id = result2["data"]["list"][0]["demandId"] demand_id = result2["data"]["list"][0]["demandId"]
# 对需求单进行审核操作 # 对需求单进行审核操作
url5 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url84") url5 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url84")
# print(url5)
request_body5 = commonFuc().get_business_data(module, "payload84", demand_id) request_body5 = commonFuc().get_business_data(module, "payload84", demand_id)
# print(request_body5)
# 发送请求 # 发送请求
result5 = requests.post(url5, json=request_body5, headers=headers) result5 = requests.post(url5, json=request_body5, headers=headers)
result5 = json.loads(result5.content) result5 = json.loads(result5.content)
# print(result5) # print(result5)
# 获取预期结果 if result5["code"] == "200":
check_dict5 = commonFuc().get_business_data(module, "checkDict84") # 获取预期结果
# 断言实际结果中是否包含预期结果的内容 check_dict5 = commonFuc().get_business_data(module, "checkDict84")
commonFuc().check_result(check_dict5, result5) # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict5, result5)
elif result5["code"] == "3007":
# 获取预期结果
check_dict5 = commonFuc().get_business_data(module, "checkDict_3007")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict5, result5)
else:
# 获取预期结果
check_dict5 = commonFuc().get_business_data(module, "checkDict_401")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict5, result5)
...@@ -19,32 +19,28 @@ username = commonFuc().get_business_data(module, "username") ...@@ -19,32 +19,28 @@ 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()
# print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
# print(headers)
# 第二步提交创建需求单(代客下单) # 第二步提交创建需求单(代客下单)
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
# print(url)
request_body = commonFuc().get_business_data(module, "payload1") request_body = commonFuc().get_business_data(module, "payload1")
# print(request_body)
# 发送请求 # 发送请求
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)
# 第三步在需求单列表查询到已创建的需求单 # 第三步在需求单列表查询到已创建的需求单
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
# print(url)
request_body = commonFuc().get_business_data(module, "payload2") request_body = commonFuc().get_business_data(module, "payload2")
# print(request_body)
# 发送请求 # 发送请求
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)
# 第四步审核刚刚创建的需求单 # 第四步审核刚刚创建的需求单
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3")
# print(url)
request_body = commonFuc().get_business_data(module, "payload3") request_body = commonFuc().get_business_data(module, "payload3")
# print(request_body)
""" """
场景:通过代客下单提交创建需求单,并完成审核 场景:通过代客下单提交创建需求单,并完成审核
用例名称:需求单审核通过 用例名称:需求单审核通过
...@@ -53,9 +49,14 @@ request_body = commonFuc().get_business_data(module, "payload3") ...@@ -53,9 +49,14 @@ request_body = commonFuc().get_business_data(module, "payload3")
# 发送请求 # 发送请求
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)
# 获取预期结果 if result["success"]:
check_dict = commonFuc().get_business_data(module, "checkDict2") # 获取预期结果
print(check_dict) check_dict = commonFuc().get_business_data(module, "checkDict2")
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_401")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
...@@ -20,18 +20,14 @@ username = commonFuc().get_business_data(module, "username1") ...@@ -20,18 +20,14 @@ username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1") password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token # 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token() cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
# print(cmdc_access_token)
headers1 = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token) headers1 = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
# print(headers1)
# 第二步创建并提交需求单 # 第二步创建并提交需求单
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url4") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url4")
# print(url)
request_body = commonFuc().get_business_data(module, "payload4") request_body = commonFuc().get_business_data(module, "payload4")
# print(request_body) # 发送请求
result = requests.post(url, json=request_body, headers=headers1) result = requests.post(url, json=request_body, headers=headers1)
result = json.loads(result.content) result = json.loads(result.content)
# print(result)
# 第三步登录后台管理系统 # 第三步登录后台管理系统
# 获取登录所需账号密码 # 获取登录所需账号密码
...@@ -39,25 +35,20 @@ username = commonFuc().get_business_data(module, "username") ...@@ -39,25 +35,20 @@ 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()
# print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
# print(headers)
# 第四步在需求单列表查询刚刚创建的需求单 # 第四步在需求单列表查询刚刚创建的需求单
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
# print(url)
request_body = commonFuc().get_business_data(module, "payload2") request_body = commonFuc().get_business_data(module, "payload2")
print(request_body)
# 发送请求 # 发送请求
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)
# 第五步进行需求单审核处理 # 第五步进行需求单审核处理
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3")
# print(url)
request_body = commonFuc().get_business_data(module, "payload3") request_body = commonFuc().get_business_data(module, "payload3")
# print(request_body)
""" """
场景:通过快速下单入口提交创建需求单,并进行审核通过操作 场景:通过快速下单入口提交创建需求单,并进行审核通过操作
用例名称:通过快速下单入口提交创建并审核需求单 用例名称:通过快速下单入口提交创建并审核需求单
...@@ -67,8 +58,13 @@ request_body = commonFuc().get_business_data(module, "payload3") ...@@ -67,8 +58,13 @@ request_body = commonFuc().get_business_data(module, "payload3")
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)
# 获取预期结果 if result["success"]:
check_dict = commonFuc().get_business_data(module, "checkDict2") # 获取预期结果
print(check_dict) check_dict = commonFuc().get_business_data(module, "checkDict2")
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result) commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_401")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
...@@ -13,7 +13,6 @@ import json ...@@ -13,7 +13,6 @@ import json
module = "cmdc_demand_create_pc" module = "cmdc_demand_create_pc"
# print(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 +23,7 @@ headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_toke ...@@ -24,6 +23,7 @@ headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_toke
# 进行需求单创建操作 # 进行需求单创建操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url") url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body = commonFuc().get_business_data(module, "payload") request_body = commonFuc().get_business_data(module, "payload")
""" """
场景:通过快速下单入口提交创建需求单 场景:通过快速下单入口提交创建需求单
用例名称:通过快速下单入口提交创建需求单 用例名称:通过快速下单入口提交创建需求单
......
...@@ -13,7 +13,6 @@ import json ...@@ -13,7 +13,6 @@ import json
module = "cmdc_demand_create_pc" module = "cmdc_demand_create_pc"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
# 获取登录所需账号密码 # 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username") username = commonFuc().get_business_data(module, "username")
...@@ -21,7 +20,11 @@ password = commonFuc().get_business_data(module, "password") ...@@ -21,7 +20,11 @@ password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token # 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token() cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
# 进行需求单草稿订单的创建
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
request_body = commonFuc().get_business_data(module, "payload2") request_body = commonFuc().get_business_data(module, "payload2")
""" """
场景:通过快速下单入口提交创建需求单草稿 场景:通过快速下单入口提交创建需求单草稿
用例名称:通过快速下单入口提交创建需求单草稿 用例名称:通过快速下单入口提交创建需求单草稿
......
...@@ -14,15 +14,18 @@ import json ...@@ -14,15 +14,18 @@ import json
module = "cmdc_demand_creation" module = "cmdc_demand_creation"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
# print(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")
# 获取登录后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, "url")
request_body = commonFuc().get_business_data(module, "payload1") request_body = commonFuc().get_business_data(module, "payload1")
""" """
场景:需求创建 场景:需求创建
用例名称:需求单创建 用例名称:需求单创建
......
...@@ -13,14 +13,18 @@ import json ...@@ -13,14 +13,18 @@ import json
module = "cmdc_demand_creation" module = "cmdc_demand_creation"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
# 获取登录所需账号密码 # 获取登录所需账号密码
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, "url2")
request_body = commonFuc().get_business_data(module, "payload2") request_body = commonFuc().get_business_data(module, "payload2")
""" """
场景:需求草稿订单的创建 场景:需求草稿订单的创建
用例名称:需求草稿订单的创建 用例名称:需求草稿订单的创建
......
...@@ -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")
# 断言实际结果中是否包含预期结果的内容 # 断言实际结果中是否包含预期结果的内容
......
...@@ -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)
...@@ -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
...@@ -15,13 +15,15 @@ import json ...@@ -15,13 +15,15 @@ import json
module = "cmdc_demand_list_pc" module = "cmdc_demand_list_pc"
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 = CmdcMaiiLogin(username, password).get_token() cmdc_access_token = CmdcMaiiLogin(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")
""" """
...@@ -36,6 +38,6 @@ result = json.loads(result.content) ...@@ -36,6 +38,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)
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