Commit 681269eb authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent 4a49c4db
......@@ -16,25 +16,22 @@ import random
module = "cmdc_demand_delete"
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 = CmdcDoLogin(username, password).get_token()
# cmdc_access_token = CmdcDoLogin("admin2", "FFtmods@365y").get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 随机生成不存在的需求单id
demand_id = random.randint(10000000000000, 1000000000000000)
request_body = commonFuc().get_business_data(module, "payload2", demand_id)
print(request_body)
"""
场景:删除不存在的需求单
用例名称:删除不存在的需求单
输出:{"success":false,"code":"demand","message":"审核拒绝没有找到子需求单","data":null,"freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -21,34 +21,27 @@ 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()
# cmdc_access_token = CmdcDoLogin("admin2", "FFtmods@365y").get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 第二步查询需求单列表中待审核的需求单
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
request_body = commonFuc().get_business_data(module, "payload40")
print(request_body)
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取demandId
demand_id = result["data"]["list"][0]["demandId"]
print(demand_id)
# 第三步删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload4", demand_id)
print(request_body)
"""
场景:删除其他状态下的需求单
用例名称:删除其他状态下的需求单
输出:{"success":true,"code":"200","message":"OK","data":1,"freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -21,47 +21,38 @@ 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()
# cmdc_access_token = CmdcDoLogin("admin2", "FFtmods@365y").get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 第二步查询需求单列表中待审核的需求单
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
request_body = commonFuc().get_business_data(module, "payload10")
print(request_body)
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取demandId
demand_id = result["data"]["list"][0]["demandId"]
print(demand_id)
# 第三步删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload1", demand_id)
print(request_body)
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body2 = commonFuc().get_business_data(module, "payload1", demand_id)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result2 = requests.post(url2, json=request_body2, headers=headers)
# 第四步重复进行删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload3")
print(request_body)
url3 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body3 = commonFuc().get_business_data(module, "payload3")
"""
场景:重复删除需求单
用例名称:重复删除需求单
输出:{"success":false,"code":"demand","message":"订单已拒绝,无法重复拒绝","data":null,"freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
result3 = requests.post(url3, json=request_body3, headers=headers)
result3 = json.loads(result3.content)
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict4")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
commonFuc().check_result(check_dict, result3)
......@@ -21,34 +21,26 @@ 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()
# cmdc_access_token = CmdcDoLogin("admin2", "FFtmods@365y").get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 第二步查询需求单列表中待审核的需求单
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
request_body = commonFuc().get_business_data(module, "payload10")
print(request_body)
request_body1 = commonFuc().get_business_data(module, "payload10")
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
result1 = requests.post(url1, json=request_body1, headers=headers)
result1 = json.loads(result1.content)
# 获取demandId
demand_id = result["data"]["list"][0]["demandId"]
print(demand_id)
demand_id = result1["data"]["list"][0]["demandId"]
# 第三步删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload1", demand_id)
print(request_body)
"""
场景:需求删除
用例名称:需求单删除
输出:{"success":true,"code":"200","message":"OK","data":1,"freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -16,25 +16,22 @@ import random
module = "cmdc_demand_fail"
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 = CmdcDoLogin(username, password).get_token()
# cmdc_access_token = CmdcDoLogin("admin2", "FFtmods@365y").get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 随机生成不存在的需求单id
demand_id = random.randint(100000000000, 100000000000000)
request_body = commonFuc().get_business_data(module, "payload3", demand_id)
print(request_body)
"""
场景:审核不存在的需求单
用例名称:审核不存在的需求单
输出:{"success":false,"code":"demand","message":"审核拒绝没有找到子需求单","data":null,"freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -21,39 +21,32 @@ 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()
# cmdc_access_token = CmdcDoLogin("admin2", "FFtmods@365y").get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 第二步查询需求单列表中审核通过的需求单
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
request_body = commonFuc().get_business_data(module, "payload40")
print(request_body)
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取demandId
demand_id = result["data"]["list"][0]["demandId"]
print(demand_id)
# 第三步进行审核操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload4", demand_id)
print(request_body)
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body1 = commonFuc().get_business_data(module, "payload4", demand_id)
"""
场景:审核其他状态下的需求单
用例名称:审核其他状态下的需求单
输出:{"success":true,"code":"200","message":"OK","data":1}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
result1 = requests.post(url1, json=request_body1, headers=headers)
result1 = json.loads(result1.content)
print(result1)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict4")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
commonFuc().check_result(check_dict, result1)
......@@ -10,59 +10,49 @@ from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json
import time
module = "cmdc_demand_fail"
# 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码
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()
# cmdc_access_token = CmdcDoLogin("admin2", "FFtmods@365y").get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 第二步查询需求单列表中待审核的需求单
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
request_body = commonFuc().get_business_data(module, "payload10")
print(request_body)
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取demandId
demand_id = result["data"]["list"][0]["demandId"]
print(demand_id)
# 第三步进行需求单审核拒绝操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload1", demand_id)
print(request_body)
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body2 = commonFuc().get_business_data(module, "payload1", demand_id)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = requests.post(url2, json=request_body2, headers=headers)
# 增加两次审核间隔时间
time.sleep(5)
# 第四步进行需求单重复审核拒绝操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload2")
print(request_body)
url3 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body3 = commonFuc().get_business_data(module, "payload2", demand_id)
"""
场景:重复审核同一个需求单
用例名称:重复审核同一个需求单
输出:{"success":false,"code":"demand","message":"订单已拒绝,无法重复拒绝","data":null,"freshToken":null}
输出:{"success":false,"code":"demand","message":"订单已提交过,请稍后操作","data":null,"freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
result3 = requests.post(url3, json=request_body3, headers=headers)
result3 = json.loads(result3.content)
print(result3)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
\ No newline at end of file
commonFuc().check_result(check_dict, result3)
......@@ -11,7 +11,6 @@ from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 impor
import requests
import json
module = "cmdc_demand_fail"
# 第一步登录后台运营平台获取cmdc_access_token
......@@ -20,40 +19,33 @@ 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()
# cmdc_access_token = CmdcDoLogin("admin2", "FFtmods@365y").get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 第二步查询需求单列表中待审核的需求单
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload10")
print(request_body)
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取demandId
demand_id = result["data"]["list"][0]["demandId"]
print(demand_id)
# 第三步进行需求单审核拒绝操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload1", demand_id)
print(request_body)
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body1 = commonFuc().get_business_data(module, "payload1", demand_id)
"""
场景:需求单审核不通过
用例名称:需求单审核不通过
输出:{"success":true,"code":"200","message":"OK","data":1}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
result1 = requests.post(url1, json=request_body1, headers=headers)
result1 = json.loads(result1.content)
print(result1)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict1")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
\ No newline at end of file
commonFuc().check_result(check_dict, result1)
......@@ -15,22 +15,20 @@ import json
module = "cmdc_demand_list"
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")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcDoLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
request_body = commonFuc().get_business_data(module, "payload1")
print(request_body)
"""
场景:传入正确参数,获取到需求列表
用例名称:获取需求列表
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -11,7 +11,6 @@ from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 impor
import requests
import json
module = "cmdc_demand_list"
# 第一步:登录后台运营系统
......@@ -20,40 +19,33 @@ 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_headers2", cmdc_access_token)
print(headers)
# 第二步,获取需求单列表
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
request_body = commonFuc().get_business_data(module, "payload20")
print(request_body)
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取demandId
demand_id = result["data"]["list"][0]["demandId"]
print(demand_id)
# 第三步,获取到demandId进行需求单删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload2", demand_id)
print(request_body)
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
# 第三步,获取到demandId进行需求单重复删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload3", demand_id)
print(request_body)
"""
场景:不可重复删除已保存订单状态下需求单,以及其他状态的需求单
用例名称:需求草稿订单删除逆向功能验证
输出:{"success":true,"code":"200","message":"OK","data":null}
备注:目前接口层未进行校验重复删除
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
......@@ -62,4 +54,4 @@ print(result)
check_dict = commonFuc().get_business_data(module, "checkDict4")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
\ No newline at end of file
commonFuc().check_result(check_dict, result)
......@@ -20,26 +20,19 @@ 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_headers2", cmdc_access_token)
print(headers)
# 第二步,获取需求单列表
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
request_body = commonFuc().get_business_data(module, "payload20")
print(request_body)
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取demandId
demand_id = result["data"]["list"][0]["demandId"]
print(demand_id)
# 第三步,获取到demandId进行需求单删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
print(url)
request_body = commonFuc().get_business_data(module, "payload2", demand_id)
print(request_body)
"""
场景:需求草稿订单可正常删除,删除后不再显示在需求列表中
用例名称:需求草稿订单删除功能验证
......
......@@ -14,17 +14,15 @@ import json
module = "cmdc_demand_list"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
# url = "https://service-slb.cmic.com.cn/order/back/listDemand"
print(url)
headers = commonFuc().get_business_data(module, "json_headers")
print(headers)
request_body = commonFuc().get_business_data(module, "payload")
print(request_body)
"""
场景:用户信息过期或获取失败,无法访问需求列表
用例名称:需求单-获取用户信息失败
输出:{"code":"401","message":"Unauthorized","success":false}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -16,22 +16,20 @@ module = "cmdc_demand_list_pc"
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")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1",cmdc_access_token)
print(headers)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
request_body = commonFuc().get_business_data(module, "payload1")
print(request_body)
"""
场景:获取到登录用户对应的需求单列表
用例名称:获取需求单列表
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -19,25 +19,19 @@ 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()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
# 获取需求单列表
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
request_body = commonFuc().get_business_data(module, "payload30")
print(request_body)
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
demand_parent_id = result["data"]["list"][0]["demandParentId"]
print(demand_parent_id)
# 对获取到的需求单进行删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3")
print(url)
request_body = commonFuc().get_business_data(module, "payload3", demand_parent_id)
print(request_body)
"""
场景:需求草稿订单可正常删除,删除后不再显示在需求列表中
用例名称:需求草稿订单删除功能验证
......
......@@ -19,25 +19,19 @@ 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()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
# 获取需求单列表
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
request_body = commonFuc().get_business_data(module, "payload20")
print(request_body)
# 发送请求
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
demand_code = result["data"]["list"][0]["demandCode"]
print(demand_code)
# 获取需求单进行取消操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
print(url)
request_body = commonFuc().get_business_data(module, "payload2", demand_code)
print(request_body)
"""
场景:在用户对应的多彩商城中的需求单列表进行需求单取消操作验证
用例名称:需求单取消操作
......
......@@ -8,54 +8,68 @@ case_tag:cmdc_api,cmdc常购清单列表商品移除,2252,2252-1,sit,bs
from common.common_func import commonFuc
from air_case.cmdc_login.多彩商城登录.多彩商城登录 import CmdcMaiiLogin
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json
module = "cmdc_frequent_purchase"
# 第一步进行用户登录获取Cmdc_access_token
# 步骤一登录后台管理系统查询商品列表获取已上架商品信息
# 获取登录后台管理系统所需账号密码
username1 = commonFuc().get_business_data(module, "username1")
password1 = commonFuc().get_business_data(module, "password1")
# 获取登录后Cmdc_access_token
cmdc_access_token1 = CmdcDoLogin(username1, password1).get_token()
headers1 = commonFuc().get_business_data(module, "json_headers", cmdc_access_token1)
# 步骤二查询已已上架商品信息
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url10")
request_body1 = commonFuc().get_business_data(module, "payload10")
# 发送请求
result1 = requests.post(url1, json=request_body1, headers=headers1)
result1 = json.loads(result1.content)
# 获取已上架商品product_id和price
product_id = result1["data"]["list"][0]["productId"]
price = result1["data"]["list"][0]["referencePrice"]
# 步骤三登录多彩商城
# 获取登录所需账号密码
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()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers3", cmdc_access_token)
print(headers)
# 第二步在购物车中新增商品
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url1)
request_body = commonFuc().get_business_data(module, "payload1")
print(request_body)
result = requests.post(url1, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
# 步骤四添加已上架商品至常购清单列表
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body2 = commonFuc().get_business_data(module, "payload1", product_id, price)
# 发送请求
result2 = requests.post(url2, json=request_body2, headers=headers)
result2 = json.loads(result2.content)
# 第三步查询购物车中新增的商品信息
url2 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
print(url2)
request_body = commonFuc().get_business_data(module, "payload2")
print(request_body)
result = requests.post(url2, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取所添加商品id
product_id = int(commonFuc().get_business_data(module, "payload1")["productId"])
print(product_id, type(product_id))
result_product_id = result["data"]["list"][0]["list"][0]["productId"]
print(result_product_id, type(result_product_id))
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
result_product_id = result3["data"]["list"][0]["list"][0]["productId"]
# 判断查询出的商品是否为新增商品
if result_product_id == product_id:
frequent_purchase_id = result["data"]["list"][0]["list"][0]["frequentPurchaseId"]
print(frequent_purchase_id)
frequent_purchase_id = result3["data"]["list"][0]["list"][0]["frequentPurchaseId"]
request_body = commonFuc().get_business_data(module, "payload3", frequent_purchase_id)
print(request_body)
# 第三步删除新增加至购物车列表的商品
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url3")
print(url)
"""
场景:从用户购物车列表移除商品
用例名称:从用户购物车列表移除商品
输出:{"success":true,"code":"200","message":"OK","data":"ok"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -21,39 +21,35 @@ 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()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
print(headers)
# 查询商品列表获取JDE已停用的商品信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url80")
print(url)
request_body = commonFuc().get_business_data(module, "payload80")
print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取商品对应的productId和referencePrice
product_id = result["data"]["list"][0]["productId"]
print(product_id)
price = result["data"]["list"][0]["referencePrice"]
print(price)
# 第二步登录多彩商城添加JDE已停用的商品至常购清单列表
# 获取登录所需账号密码
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()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
print(headers)
# 添加JDE已停用的商品至常购清单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
print(url)
request_body = commonFuc().get_business_data(module, "payload8", product_id, price)
print(request_body)
"""
场景:新增JDE已停用的商品至常购清单列表
用例名称:新增JDE已停用的商品至常购清单列表
输出:{'success': False, 'code': 'addFrequentPurchaseFail', 'message': '商品为失效状态,不可加入常购清单', 'data': None, 'freshToken': None}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -23,24 +23,23 @@ 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()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers4", cmdc_access_token)
print(headers)
# 随机生成productId
product_id = random.randint(1000000000000, 100000000000000)
print(product_id)
request_body = commonFuc().get_business_data(module, "payload4", product_id)
print(request_body)
request_body = commonFuc().get_business_data(module, "payload400", product_id)
"""
场景:新增不存在的商品至常购清单列表
用例名称:新增不存在的商品至常购清单列表
输出:{"success":false,"code":"1078","message":"该商品不存在,加入购物车失败","data":null,"freshToken":null}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict4")
check_dict = commonFuc().get_business_data(module, "checkDict400")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
......@@ -21,39 +21,35 @@ 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()
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, "url10")
print(url)
request_body = commonFuc().get_business_data(module, "payload10")
print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取已加上商品信息并进行参数化处理
product_id = result["data"]["list"][0]["productId"]
print(product_id)
price = result["data"]["list"][0]["referencePrice"]
print(price)
# 第二步登录多彩商城添加商品至常购清单列表
# 获取登录所需账号密码
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()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", 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", product_id, price)
print(request_body)
"""
场景:新增商品至常购清单列表
用例名称:新增商品至常购清单列表
输出:{"success":true,"code":"200","message":"OK","data":"ok"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
......@@ -21,39 +21,35 @@ 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()
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, "url40")
print(url)
request_body = commonFuc().get_business_data(module, "payload40")
print(request_body)
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取商品信息并进行参数化处理
product_id = result["data"]["list"][0]["productId"]
print(product_id)
price = result["data"]["list"][0]["referencePrice"]
print(price)
# 第二步登录多彩商城添加已失效商品至常购清单列表
# 获取登录所需账号密码
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()
print(cmdc_access_token)
headers = commonFuc().get_business_data(module, "json_headers1", 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, "payload4", product_id, price)
print(request_body)
"""
场景:新增已失效商品至常购清单列表
用例名称:新增已失效商品至常购清单列表
输出:{'success': False, 'code': 'addFrequentPurchaseFail', 'message': '商品为失效状态,不可加入常购清单', 'data': None, 'freshToken': None}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......
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