Commit 5271a37a authored by 周念东's avatar 周念东
Browse files

20240617

parents ced008e1 c3acdd56
......@@ -28,9 +28,9 @@ request_body = commonFuc().get_business_data(module, "payload_goods")
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取商品的productId、productCode、companyCode
product_id = result["data"]["list"][0]["productid"]
product_code = result["data"]["list"][0]["productcode"]
company_code = result["data"]["list"][0]["filialecode"]
product_id = result["data"]["list"][1]["productid"]
product_code = result["data"]["list"][1]["productcode"]
company_code = result["data"]["list"][1]["filialecode"]
# 第四步验证商品活动列表中是否包含对应的优惠券
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url_discount")
......@@ -44,13 +44,17 @@ request_body = [{"productId": product_id, "productCode": product_code, "companyC
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
# print(result)
result = {"couponAmount": result["data"][0]["coupon"]["couponAmount"]}
result["api_time"] = api_time
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict3")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -15,8 +15,8 @@ module = "cmdc_coupon"
# 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username3")
password = commonFuc().get_business_data(module, "password3")
username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
......@@ -32,8 +32,11 @@ request_body = commonFuc().get_business_data(module, "payload8")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
result = {"couponId": result["data"]["couponId"]}
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict8")
# 断言实际结果中是否包含预期结果的内容
......
......@@ -45,7 +45,10 @@ request_body = commonFuc().get_business_data(module, "payload_collect_coupon", c
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
result["api_time"] = api_time
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_collect_coupon2")
......
......@@ -45,7 +45,10 @@ request_body = commonFuc().get_business_data(module, "payload_collect_coupon", c
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
result["api_time"] = api_time
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_collect_coupon4")
......
......@@ -45,7 +45,10 @@ request_body = commonFuc().get_business_data(module, "payload_collect_coupon", c
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
result["api_time"] = api_time
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_collect_coupon3")
......
......@@ -46,7 +46,10 @@ request_body = commonFuc().get_business_data(module, "payload_collect_coupon", c
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
result["api_time"] = api_time
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_collect_coupon")
......
......@@ -40,12 +40,15 @@ request_body = commonFuc().get_business_data(module, "payload_collect_coupon", c
"""
场景:优惠券领取次数超限制验证
用例名称:优惠券领取次数超限制验证
输出:{"success":false,"code":"500","message":"该券已超过用户最大领取限制,请您关注平台后续其他活动","data":null,"freshToken":null}
输出:{"success":false,"code":"500","message":"该券已抢完,请您关注平台后续其他活动","data":null,"freshToken":null}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
result["api_time"] = api_time
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_collect_coupon1")
......
......@@ -44,7 +44,10 @@ request_body = commonFuc().get_business_data(module, "payload_collect_coupon", c
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
result["api_time"] = api_time
if result["code"] == "200":
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_collect_coupon")
......
......@@ -15,8 +15,8 @@ module = "cmdc_coupon"
# 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username3")
password = commonFuc().get_business_data(module, "password3")
username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
......@@ -27,7 +27,7 @@ request_body = commonFuc().get_business_data(module, "payload9")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 查询优惠券活动id
coupon_id = result["data"]["list"][0]["couponId"]
......@@ -43,9 +43,12 @@ request_body = commonFuc().get_business_data(module, "payload10", coupon_id)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
# 获取商品对应的优惠券id
result = {"couponId": result["data"][0]["couponId"]}
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict10", coupon_id)
# 断言实际结果中是否包含预期结果的内容
......
......@@ -32,7 +32,10 @@ request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict1")
# 断言实际结果中是否包含预期结果的内容
......
......@@ -15,8 +15,8 @@ module = "cmdc_coupon"
# 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username3")
password = commonFuc().get_business_data(module, "password3")
username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
......@@ -56,10 +56,17 @@ request_body = commonFuc().get_business_data(module, "payload11", product_id, co
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
result = {"couponId": result["data"]["couponList"][0]["couponId"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict10", coupon_id)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
result["api_time"] = api_time
# print(result)
for i in result["data"]["couponList"]:
if i["couponId"] == coupon_id:
# 获取商品对应优惠券id
result = {"couponId": i["couponId"]}
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict10", coupon_id)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -28,10 +28,10 @@ request_body1 = commonFuc().get_business_data(module, "payload1")
# 发送请求
result1 = requests.post(url1, json=request_body1, headers=headers1)
result1 = json.loads(result1.content)
# 获取预期结果
check_dict1 = commonFuc().get_business_data(module, "checkDict1")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict1, result1)
# # 获取预期结果
# check_dict1 = commonFuc().get_business_data(module, "checkDict1")
# # 断言实际结果中是否包含预期结果的内容
# commonFuc().check_result(check_dict1, result1)
# 第三步查询需求单列表中草稿订单列表
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
......@@ -39,10 +39,10 @@ request_body2 = commonFuc().get_business_data(module, "payload2")
# 发送请求
result2 = requests.post(url2, json=request_body2, headers=headers1)
result2 = json.loads(result2.content)
# 获取预期结果
check_dict2 = commonFuc().get_business_data(module, "checkDict2")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict2, result2)
# # 获取预期结果
# check_dict2 = commonFuc().get_business_data(module, "checkDict2")
# # 断言实际结果中是否包含预期结果的内容
# commonFuc().check_result(check_dict2, result2)
# 第四步获取到新增草稿订单对应的id并进行参数化赋值处理
demand_parent_id = result2["data"]["list"][0]["demandParentId"]
......@@ -52,7 +52,10 @@ url3 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3")
request_body3 = commonFuc().get_business_data(module, "payload3", demand_parent_id)
# 发送请求
result3 = requests.get(url3, params=request_body3, headers=headers1)
# 获取接口响应时间
api_time = result3.elapsed.total_seconds()
result3 = json.loads(result3.content)
result3["api_time"] = api_time
# 获取预期结果
check_dict3 = commonFuc().get_business_data(module, "checkDict3")
# 断言实际结果中是否包含预期结果的内容
......
......@@ -21,7 +21,7 @@ password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token并进行参数化赋值
cmdc_access_token1 = CmdcMaiiLogin(username, password).get_token()
headers1 = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token1)
print(headers1)
# 第二步进行需求单创建
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url4")
request_body1 = commonFuc().get_business_data(module, "payload4")
......@@ -38,11 +38,12 @@ order_num = result1["data"]["国药集团北京医疗器械有限公司"]["deman
# 登录后台管理系统获取token信息
# 获取登录后台管理系统所需账号密码
username1 = commonFuc().get_business_data(module, "username1")
password1 = commonFuc().get_business_data(module, "password1")
username1 = commonFuc().get_business_data(module, "username4")
password1 = commonFuc().get_business_data(module, "password4")
# 获取登录后Cmdc_access_token并进行参数化赋值
cmdc_access_token = CmdcDoLogin(username1, password1).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
# print(username1, password1)
# 第三步在需求单列表根据订单编号查询出新创建的需求单
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url80")
......@@ -50,6 +51,7 @@ request_body2 = commonFuc().get_business_data(module, "payload80")
# 发送请求
result2 = requests.post(url2, json=request_body2, headers=headers)
result2 = json.loads(result2.content)
# print(result2)
# 获取预期结果
check_dict2 = commonFuc().get_business_data(module, "checkDict80")
# 断言实际结果中是否包含预期结果的内容
......@@ -65,7 +67,10 @@ url3 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url82"
request_body3 = commonFuc().get_business_data(module, "payload82", demand_id, demand_code)
# 发送请求
result3 = requests.post(url3, json=request_body3, headers=headers)
# 获取接口响应时间
api_time = result3.elapsed.total_seconds()
result3 = json.loads(result3.content)
result3["api_time"] = api_time
# print(result3)
# 获取预期结果
check_dict3 = commonFuc().get_business_data(module, "checkDict82")
......
......@@ -28,18 +28,18 @@ request_body1 = commonFuc().get_business_data(module, "payload4")
# 发送请求
result1 = requests.post(url1, json=request_body1, headers=headers1)
result1 = json.loads(result1.content)
# 获取预期结果
check_dict1 = commonFuc().get_business_data(module, "checkDict4")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict1, result1)
# # 获取预期结果
# check_dict1 = commonFuc().get_business_data(module, "checkDict4")
# # 断言实际结果中是否包含预期结果的内容
# commonFuc().check_result(check_dict1, result1)
# 获取新创建需求单对应的订单编号
order_num = result1["data"]["国药集团北京医疗器械有限公司"]["demandItems"][0]["demandCode"]
# print(order_num)
# 登录后台管理系统获取token信息
# 获取登录后台管理系统所需账号密码
username1 = commonFuc().get_business_data(module, "username1")
password1 = commonFuc().get_business_data(module, "password1")
username1 = commonFuc().get_business_data(module, "username4")
password1 = commonFuc().get_business_data(module, "password4")
# 获取登录后Cmdc_access_token并进行参数化赋值
cmdc_access_token = CmdcDoLogin(username1, password1).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
......@@ -50,10 +50,10 @@ request_body2 = commonFuc().get_business_data(module, "payload80")
# 发送请求
result2 = requests.post(url2, json=request_body2, headers=headers)
result2 = json.loads(result2.content)
# 获取预期结果
check_dict2 = commonFuc().get_business_data(module, "checkDict80")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict2, result2)
# # 获取预期结果
# check_dict2 = commonFuc().get_business_data(module, "checkDict80")
# # 断言实际结果中是否包含预期结果的内容
# commonFuc().check_result(check_dict2, result2)
# 第四步获取到新增需求单对应的id并进行参数化赋值处理
demand_id = result2["data"]["list"][0]["demandId"]
......@@ -65,8 +65,10 @@ url3 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url81"
request_body3 = commonFuc().get_business_data(module, "payload81", demand_id, demand_code)
# 发送请求
result3 = requests.post(url3, json=request_body3, headers=headers)
# 获取接口响应时间
api_time = result3.elapsed.total_seconds()
result3 = json.loads(result3.content)
# print(result3)
result3["api_time"] = api_time
# 获取预期结果
check_dict3 = commonFuc().get_business_data(module, "checkDict81")
# 断言实际结果中是否包含预期结果的内容
......
......@@ -28,18 +28,15 @@ request_body1 = commonFuc().get_business_data(module, "payload4")
# 发送请求
result1 = requests.post(url1, json=request_body1, headers=headers1)
result1 = json.loads(result1.content)
# 获取预期结果
check_dict1 = commonFuc().get_business_data(module, "checkDict4")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict1, result1)
# 获取新创建需求单对应的订单编号
order_num = result1["data"]["国药集团北京医疗器械有限公司"]["demandItems"][0]["demandCode"]
# print(order_num)
# 登录后台管理系统获取token信息
# 获取登录后台管理系统所需账号密码
username1 = commonFuc().get_business_data(module, "username2")
password1 = commonFuc().get_business_data(module, "password2")
username1 = commonFuc().get_business_data(module, "username4")
password1 = commonFuc().get_business_data(module, "password4")
# 获取登录后Cmdc_access_token并进行参数化赋值
cmdc_access_token = CmdcDoLogin(username1, password1).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
......@@ -50,22 +47,24 @@ request_body2 = commonFuc().get_business_data(module, "payload5", order_num)
# 发送请求
result2 = requests.post(url2, json=request_body2, headers=headers)
result2 = json.loads(result2.content)
# 获取预期结果
check_dict2 = commonFuc().get_business_data(module, "checkDict5")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict2, result2)
# # 获取预期结果
# check_dict2 = commonFuc().get_business_data(module, "checkDict5")
# # 断言实际结果中是否包含预期结果的内容
# commonFuc().check_result(check_dict2, result2)
# 第四步获取到新增需求单对应的id并进行参数化赋值处理
demand_id = result2["data"]["list"][0]["demandId"]
# print(demand_id)
# 步骤五对新创建的需求单订单进行删除操作
# 步骤五对新创建的需求单订单进行审核拒绝操作
url3 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url6")
request_body3 = commonFuc().get_business_data(module, "payload6", demand_id)
# 发送请求
result3 = requests.post(url3, json=request_body3, headers=headers)
# 获取接口响应时间
api_time = result3.elapsed.total_seconds()
result3 = json.loads(result3.content)
# print(result3)
result3["api_time"] = api_time
# 获取预期结果
check_dict3 = commonFuc().get_business_data(module, "checkDict6")
# 断言实际结果中是否包含预期结果的内容
......
......@@ -28,24 +28,16 @@ request_body1 = commonFuc().get_business_data(module, "payload10")
# 发送请求
result1 = requests.post(url1, json=request_body1, headers=headers1)
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"]
# print(order_num)
# 第三步在需求单列表根据订单编号查询出新创建的需求单
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url20")
request_body2 = commonFuc().get_business_data(module, "payload20", order_num)
# 发送请求
result2 = requests.post(url2, json=request_body2, headers=headers1)
result2 = json.loads(result2.content)
# 获取预期结果
check_dict2 = commonFuc().get_business_data(module, "checkDict2")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict2, result2)
# 第四步获取到新增需求单对应的id并进行参数化赋值处理
demand_code = result2["data"]["list"][0]["demandCode"]
......@@ -56,11 +48,6 @@ request_body3 = commonFuc().get_business_data(module, "payload30", demand_code)
# 发送请求
result3 = requests.post(url3, json=request_body3, headers=headers1)
result3 = json.loads(result3.content)
# print(result3)
# 获取预期结果
check_dict3 = commonFuc().get_business_data(module, "checkDict30")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict3, result3)
"""
场景:流程验证-快速下单创建-申请取消-审核
......@@ -68,9 +55,8 @@ commonFuc().check_result(check_dict3, result3)
"""
# 步骤六在后台运营系统查询出用户提交取消申请
# 登录后台运营系统获取token信息
# 获取登录多采商城所需账号密码
username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
username = commonFuc().get_business_data(module, "username4")
password = commonFuc().get_business_data(module, "password4")
# 获取登录后Cmdc_access_token并进行参数化赋值
cmdc_access_token = CmdcDoLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
......@@ -80,24 +66,33 @@ request_body4 = commonFuc().get_business_data(module, "payload83", demand_code)
# 发送请求
result4 = requests.post(url4, json=request_body4, headers=headers)
result4 = json.loads(result4.content)
# print(result4)
# 获取预期结果
check_dict4 = commonFuc().get_business_data(module, "checkDict83")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict4, result4)
# 获取demandid
demand_id = result2["data"]["list"][0]["demandId"]
# 对需求单进行审核操作
url5 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url84")
# print(url5)
request_body5 = commonFuc().get_business_data(module, "payload84", demand_id)
# print(request_body5)
# 发送请求
result5 = requests.post(url5, json=request_body5, headers=headers)
# 获取接口响应时间
api_time = result5.elapsed.total_seconds()
result5 = json.loads(result5.content)
# print(result5)
# 获取预期结果
check_dict5 = commonFuc().get_business_data(module, "checkDict84")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict5, result5)
result5["api_time"] = api_time
if result5["code"] == "200":
# 获取预期结果
check_dict5 = commonFuc().get_business_data(module, "checkDict84")
# 断言实际结果中是否包含预期结果的内容
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")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
# print(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")
# print(url)
request_body = commonFuc().get_business_data(module, "payload1")
# print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 第三步在需求单列表查询到已创建的需求单
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
# print(url)
request_body = commonFuc().get_business_data(module, "payload2")
# print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 第四步审核刚刚创建的需求单
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3")
# print(url)
request_body = commonFuc().get_business_data(module, "payload3")
# print(request_body)
"""
场景:通过代客下单提交创建需求单,并完成审核
用例名称:需求单审核通过
......@@ -52,10 +48,23 @@ request_body = commonFuc().get_business_data(module, "payload3")
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
result["api_time"] = api_time
if result["success"]:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2_1")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
elif result["code"] == "401":
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_401")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -20,18 +20,14 @@ username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
# print(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")
# print(url)
request_body = commonFuc().get_business_data(module, "payload4")
# print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers1)
result = json.loads(result.content)
# print(result)
# 第三步登录后台管理系统
# 获取登录所需账号密码
......@@ -39,25 +35,20 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
# print(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")
# print(url)
request_body = commonFuc().get_business_data(module, "payload2")
print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 第五步进行需求单审核处理
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3")
# print(url)
request_body = commonFuc().get_business_data(module, "payload3")
# print(request_body)
request_body = commonFuc().get_business_data(module, "payload40")
"""
场景:通过快速下单入口提交创建需求单,并进行审核通过操作
用例名称:通过快速下单入口提交创建并审核需求单
......@@ -65,10 +56,23 @@ request_body = commonFuc().get_business_data(module, "payload3")
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
print(result)
result["api_time"] = api_time
if result["success"]:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2_1")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
elif result["code"] == "401":
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_401")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -13,15 +13,17 @@ import json
module = "cmdc_demand_create_pc"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
# print(url)
# 获取登录所需账号密码
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_headers", cmdc_access_token)
# 进行需求单创建操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body = commonFuc().get_business_data(module, "payload")
"""
场景:通过快速下单入口提交创建需求单
用例名称:通过快速下单入口提交创建需求单
......@@ -29,10 +31,21 @@ request_body = commonFuc().get_business_data(module, "payload")
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
result["api_time"] = api_time
# print(result)
if result["success"]:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict_1")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
\ No newline at end of file
......@@ -13,7 +13,6 @@ import json
module = "cmdc_demand_create_pc"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
......@@ -21,7 +20,11 @@ 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)
# 进行需求单草稿订单的创建
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
request_body = commonFuc().get_business_data(module, "payload2")
"""
场景:通过快速下单入口提交创建需求单草稿
用例名称:通过快速下单入口提交创建需求单草稿
......@@ -29,10 +32,12 @@ request_body = commonFuc().get_business_data(module, "payload2")
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = result.elapsed.total_seconds()
result = json.loads(result.content)
# print(result)
result["api_time"] = api_time
# 获取预期结果
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