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

Merge branch 'master' into 'main'

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

See merge request !5
parents ffa18436 8fa1e69c
......@@ -20,12 +20,14 @@ 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)
# 获取需求单列表查询待客户确认需求单
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload50")
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取需求单信息
demand_parent_id = result["data"]["list"][0]["demandParentId"]
demand_id = result["data"]["list"][0]["demandId"]
......@@ -44,6 +46,6 @@ result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict5")
print(check_dict)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -20,12 +20,14 @@ 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)
# 获取需求单列表查询待客户确认需求单
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload40")
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取需求单信息
demand_parent_id = result["data"]["list"][0]["demandParentId"]
demand_id = result["data"]["list"][0]["demandId"]
......@@ -44,6 +46,6 @@ result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict4")
print(check_dict)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -52,6 +52,5 @@ result = json.loads(result.content)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict3")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -26,6 +26,8 @@ request_body = commonFuc().get_business_data(module, "payload20")
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
# 获取到需求单信息
demand_code = result["data"]["list"][0]["demandCode"]
# 获取需求单进行取消操作
......@@ -43,6 +45,6 @@ result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2")
print(check_dict)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -22,7 +22,7 @@ cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
# 设置需要查询的生产厂家
manufacturer = "A"
manufacturer = "B"
# 第二步进行生产厂家模糊查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url7")
request_body = commonFuc().get_business_data(module, "payload7", manufacturer)
......@@ -36,11 +36,18 @@ request_body = commonFuc().get_business_data(module, "payload7", manufacturer)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取查询结果中厂家信息
result = {"data": result["data"][0][0]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict7", manufacturer)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# print(result)
if result["data"]:
# 获取查询结果中厂家信息
result = {"data": result["data"][0][0]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict7", manufacturer)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict7_1")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -32,13 +32,15 @@ result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_code = result["data"]["list"][random_demand]["demandCode"]
demand_parent_code = result["data"]["list"][random_demand]["demandParentCode"]
# demand_code = result["data"]["list"][random_demand]["demandCode"]
demand_code = "17018438457347575"
# demand_parent_code = result["data"]["list"][random_demand]["demandParentCode"]
demand_parent_code = "s2312061400015"
# 第三步获取需求单对应的操作记录
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url12")
request_body = commonFuc().get_business_data(module, "payload12", demand_code, demand_parent_code)
# print(request_body)
"""
场景: 获取需求单操作记录信息验证
用例名称:获取需求单操作记录信息验证
......
......@@ -53,6 +53,7 @@ result2 = json.loads(result2.content)
# 第三步查询购物车中新增的商品信息
url3 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
request_body3 = commonFuc().get_business_data(module, "payload2")
# 发送请求
result3 = requests.post(url3, json=request_body3, headers=headers)
result3 = json.loads(result3.content)
# 获取购物车列表中商品对应的productId
......
......@@ -16,8 +16,6 @@ import random
module = "cmdc_frequent_purchase"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url)
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
......@@ -26,6 +24,8 @@ cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers4", cmdc_access_token)
# 随机生成productId
product_id = random.randint(1000000000000, 100000000000000)
# 将商品添加至购物车列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload400", product_id)
"""
......@@ -37,9 +37,9 @@ request_body = commonFuc().get_business_data(module, "payload400", product_id)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict400")
print(check_dict)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -25,6 +25,7 @@ headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_tok
# 第二步切换至子站点
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2000")
request_body = commonFuc().get_business_data(module, "payload2000")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 添加商品至常购清单列表
......
......@@ -45,6 +45,7 @@ headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_tok
# 第三步切换至子站点
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2000")
request_body = commonFuc().get_business_data(module, "payload2001")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 第四步添加已失效商品至常购清单列表
......
......@@ -22,6 +22,7 @@ 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)
# 查询商品列表获取控销商品信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url50")
request_body = commonFuc().get_business_data(module, "payload50")
......@@ -44,6 +45,7 @@ headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_tok
# 第三步切换至子站点
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2000")
request_body = commonFuc().get_business_data(module, "payload2001")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 第四步添加控销商品至常购清单列表
......
......@@ -44,6 +44,7 @@ headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_tok
# 第三步切换至子站点
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2000")
request_body = commonFuc().get_business_data(module, "payload2001")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 第四步添加赠品至常购清单列表
......
......@@ -57,6 +57,7 @@ headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_tok
# 切换至子站点
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2000")
request_body = commonFuc().get_business_data(module, "payload2001")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 添加已商品至常购清单列表
......@@ -81,6 +82,7 @@ commonFuc().check_result(check_dict, result)
# 切换至子站点
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2000")
request_body = commonFuc().get_business_data(module, "payload2002")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# 添加商品至常购清单列表
......
......@@ -13,14 +13,16 @@ import json
module = "cmdc_frequent_purchase"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
# 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_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")
"""
......
......@@ -24,6 +24,7 @@ headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_toke
# 第二步进行产品线查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3")
request_body = commonFuc().get_business_data(module, "payload3")
"""
场景:产品线查询
用例名称:产品线查询
......
......@@ -41,7 +41,7 @@ group_code = result["data"]["list"][0]["groupCode"]
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url28")
request_body = commonFuc().get_business_data(module, "payload28", product_info, product_line_code, company_code,
group_product_code, group_name, group_material_code)
print(request_body)
# print(request_body)
"""
场景:套包列表查询条件验证_商品详情页跳转
......@@ -53,7 +53,7 @@ print(request_body)
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# print(result)
# 获取商品对应的groupCode
result = {"groupCode": result["data"][0]["groupCode"]}
# 获取预期结果
......
......@@ -45,7 +45,7 @@ request_body = commonFuc().get_business_data(module, "payload9", group_id)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict9")
# 断言实际结果中是否包含预期结果的内容
......
......@@ -32,6 +32,7 @@ file_path = BASE_DIR + "/data/cmdc_files/套包按条件删除.xlsx"
# 获取套包列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, headers=headers, json=request_body)
result = json.loads(result.content)
......@@ -63,7 +64,7 @@ file.close()
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url22")
request_body = {"groupIds": [result["data"]["freseniusGroups"][0]["products"][0]["groupId"]], "type": 1, "remarks": "",
"groupType": 3}
print(request_body)
# print(request_body)
"""
场景:套包批量删除
......@@ -74,7 +75,7 @@ print(request_body)
# 发送请求
result = requests.post(url, headers=headers, json=request_body)
result = json.loads(result.content)
print(result)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict21")
......
......@@ -32,6 +32,7 @@ file_path = BASE_DIR + "/data/cmdc_files/套包商品批量维护模板.xlsx"
# 获取商品列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url19")
request_body = commonFuc().get_business_data(module, "payload19")
# 发送请求
result = requests.post(url, headers=headers, json=request_body)
result = json.loads(result.content)
......
......@@ -41,8 +41,14 @@ request_body = result["data"]["list"][0]
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict17")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# print(result)
if result["success"]:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict17")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict17_1")
# 断言实际结果中是否包含预期结果的内容
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