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

Merge branch 'master' into 'main'

Master|需求单模块归档合并

See merge request !4
parents c9176154 d067bf09
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取订单变动明细金额验证,2289,2289-20,sit,bs
涉及到接口:多采商城获取订单变动明细列表接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_code = result["data"]["list"][random_demand]["demandCode"]
demand_code = "17020165859551447"
# 第三步获取需求单对应的订单变动明细列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url18")
request_body = commonFuc().get_business_data(module, "payload18", demand_code)
# print(request_body)
"""
场景: 获取订单变动明细金额验证
用例名称:获取订单变动明细金额验证
输出:{"isChange":True}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取订单明细列表中isChange
result = {"isChange": result["data"]["isChange"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict18")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取订单变动明细验证,2289,2289-18,sit,bs
涉及到接口:多采商城获取订单变动明细接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_code = result["data"]["list"][random_demand]["demandCode"]
demand_code = "17020165859551447"
# 第三步获取需求单对应的订单变动明细列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url16")
request_body = commonFuc().get_business_data(module, "payload16", demand_code)
# print(request_body)
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
# 获取明细id
demand_change_id = result["data"][0]["demandChangeId"]
# 第四步查看明细列表中订单变动明细详情
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url17")
request_body = commonFuc().get_business_data(module, "payload17", demand_change_id)
"""
场景: 获取订单变动明细验证
用例名称:获取订单变动明细验证
输出:{"demandChangeId":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取明细demandChangeId
result = {"demandChangeId": result["data"]["list"][0]["demandChangeId"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict17", demand_change_id)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取订单支付金额验证,2289,2289-28,sit,bs
涉及到接口:多采商城支付页面获取订单支付金额接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload27_1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
code = result["data"]["list"][random_demand]["demandParentCode"]
customer_charge = result["data"]["list"][random_demand]["customerCharge"]
# 第三步获取支付页面订单支付金额
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url28")
request_body = commonFuc().get_business_data(module, "payload28", code)
# print(request_body)
"""
场景: 获取订单支付金额验证
用例名称:获取订单支付金额验证
输出:{"customerCharge":"%s"}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取需求单对应的客户折扣
result = {"customerCharge": result["data"]["customerCharge"]}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict28", customer_charge)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取订单数据验证_订单修改,2289,2289-22,sit,bs
涉及到接口:多采商城需求单编辑接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload20_1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_id = result["data"]["list"][random_demand]["demandId"]
# demand_id = "40187"
# 第三步获取需求单对应的子单详情
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url20")
request_body = commonFuc().get_business_data(module, "payload20", demand_id)
# print(request_body)
"""
场景: 获取订单数据验证_订单修改
用例名称:获取订单数据验证_订单修改
输出:{"success":true,"code":"200","message":"查询成功"}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict20")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取订单类型接口验证,2289,2289-6,sit,bs
涉及到接口:多采商城需求单列表订单类型获取接口
"""
from common.common_func import commonFuc
import requests
import json
module = "cmdc_demand_mall"
# 第二步获取站点信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url6")
request_body = commonFuc().get_business_data(module, "payload6")
"""
场景: 验证多采商城需求单管理列表,获取订单类型接口连通性
用例名称:获取订单类型接口验证
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.get(url, params=request_body)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict6")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取订单销售合同配置验证,2289,2289-17,sit,bs
涉及到接口:多采商城获取订单销售合同接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_id = result["data"]["list"][random_demand]["demandId"]
# demand_id = "40187"
# 第三步获取需求单对应的销售合同配置
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url15")
request_body = commonFuc().get_business_data(module, "payload15", demand_id)
# print(request_body)
"""
场景: 获取订单销售合同配置验证
用例名称:获取订单销售合同配置验证
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict15")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取需求列表明细_支付页面,2289,2289-27,sit,bs
涉及到接口:多采商城支付页面获取需求列表明细接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload27_1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_parent_code = result["data"]["list"][random_demand]["demandParentCode"]
# 第三步获取支付页面需求单列表明细
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url27")
request_body = commonFuc().get_business_data(module, "payload27", demand_parent_code)
# print(request_body)
"""
场景: 获取需求列表明细_支付页面
用例名称:获取需求列表明细_支付页面
输出:{"demandParentCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取需求单详情中demandParentCode
result = {"demandParentCode": result["data"]["list"][0]["demandParentCode"]}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict27", demand_parent_code)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取需求单子单列表验证,2289,2289-15,sit,bs
涉及到接口:多采商城获取需求单子单列表接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_code = result["data"]["list"][random_demand]["demandCode"]
# demand_code = "17022496982880461"
demand_parent_code = result["data"]["list"][random_demand]["demandParentCode"]
# demand_parent_code = "17022496982880461"
# 第三步获取需求单对应子单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url13")
request_body = commonFuc().get_business_data(module, "payload13", demand_code, demand_parent_code)
# print(request_body)
"""
场景: 获取需求单子单列表验证
用例名称:获取需求单子单列表验证
输出:{"demandSubCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
if result["data"]["list"]:
result = {"demandSubCode": result["data"]["list"][0]["demandSubCode"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict13", demand_parent_code)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict13_1")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取需求单子单详情验证,2289,2289-16,sit,bs
涉及到接口:多采商城获取需求单子单详情接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_id = result["data"]["list"][random_demand]["demandId"]
# demand_id = "40187"
# 第三步获取需求单对应的子单详情
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url14")
request_body = commonFuc().get_business_data(module, "payload14", demand_id)
# print(request_body)
"""
场景: 获取需求单子单详情验证
用例名称:获取需求单子单详情验证
输出:{"success":true,"code":"200","message":"请求成功,展示操作流水"}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
print(result)
if result["data"]:
result = {"demandId": result["data"][0]["demandId"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict14", demand_id)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict14_1")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取需求单操作记录信息验证,2289,2289-13,sit,bs
涉及到接口:多采商城获取需求单对应的操作记录接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
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"]
# 第三步获取需求单对应的操作记录
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)
"""
场景: 获取需求单操作记录信息验证
用例名称:获取需求单操作记录信息验证
输出:{"success":true,"code":"200","message":"请求成功,展示操作流水"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict12")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取需求单详情验证,2289,2289-9,sit,bs
涉及到接口:多采商城获取需求单详情接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_parent_code = result["data"]["list"][random_demand]["demandParentCode"]
demand_code = result["data"]["list"][random_demand]["demandCode"]
# 第三步在需求单列表进行需求单查询操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url8")
request_body = commonFuc().get_business_data(module, "payload8", demand_parent_code, demand_code)
# print(request_body)
"""
场景: 验证是否可以正常获取到需求单详情
用例名称:获取需求单详情验证
输出:{"demandCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取需求单详情中订单编号
result = {"demandCode": result["data"]["demandHead"]["demandCode"]}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict8", demand_code)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc解除订单占用功能验证,2289,2289-24,sit,bs
涉及到接口:多采商城需求单解除订单占用接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_id = result["data"]["list"][random_demand]["demandId"]
# demand_id = "40187"
# 第三步解除订单占用
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url24")
request_body = commonFuc().get_business_data(module, "payload24", demand_id)
# print(request_body)
"""
场景: 解除订单占用功能验证
用例名称:解除订单占用功能验证
输出:{"success":true,"code":"200","message":"OK","data":"0"}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict24")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc订单修改功能验证,2289,2289-25,sit,bs
涉及到接口:多采商城需求单编辑接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步进行需求单编辑修改操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url25")
request_body = commonFuc().get_business_data(module, "payload25")
# print(request_body)
"""
场景: 订单修改功能验证
用例名称:订单修改功能验证
输出:{"demandCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict25")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc订单导出功能验证_需求单列表,2289,2289-8,sit,bs
涉及到接口:多采商城需求单列表订单导出接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
from common.handle_excel import HandleExcel
import requests
import random
import json
import os
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
order_num = result["data"]["list"][random_demand]["demandCode"]
# 第三步需求单列表进行订单导出操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url21")
request_body = commonFuc().get_business_data(module, "payload21", order_num)
# print(request_body)
"""
场景: 验证多采商城需求单列表订单导出功能
用例名称:订单导出功能验证_需求单列表
输出:{"demandCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# result = json.loads(result.content)
# print(result)
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/需求单管理列表.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取文件中订单编号
excel = HandleExcel(file_path, "Sheet1")
result = {"demandCode": excel.read_data()[0].get("订单编号")}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict21", order_num)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc需求单列表获取接口验证,2289,2289-1,sit,bs
涉及到接口:多采商城需求单列表获取接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步查询需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
"""
场景: 验证获取需求单列表接口连通性
用例名称:需求单列表获取接口验证
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict1")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc需求单取消功能验证,2289,2289-14,sit,bs
涉及到接口:多采商城需求单取消接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
from common.db.db import mySql
import requests
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 数据库操作
mysql_handle = mySql()
# 获取conf.ini文件中配置的数据库信息
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 第二步进行需求单取消操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url23")
request_body = commonFuc().get_business_data(module, "payload23")
# print(request_body)
"""
场景: 需求单取消功能验证
用例名称:需求单取消功能验证
输出:{"orderStatus":201}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
if result["success"]:
# 查询需求单状态
sql = "SELECT t.orderStatus FROM `cmdc-order`.tc_demand t WHERE t.demandId = 40213"
result = {"orderStatus": mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql)[0][0]}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict23")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict23_1")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 进行需求单状态调整为待审核操作
sql = "UPDATE `cmdc-order`.tc_demand t SET t.orderStatus = 102, t.auditStatus = 0 WHERE t.demandId = 40213"
mysql_handle.executeUpdate(host, port, user, pwd, "cmdc-order", sql)
\ No newline at end of file
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc需求单商品返利明细获取验证,2289,2289-26,sit,bs
涉及到接口:多采商城获取需求单商品返利明细接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_code = result["data"]["list"][random_demand]["demandCode"]
# demand_code = "16974216158935068"
# 第四步查看需求单中商品对应的返利明细
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url26")
request_body = commonFuc().get_business_data(module, "payload26", demand_code)
"""
场景: 需求单商品返利明细获取验证
用例名称:需求单商品返利明细获取验证
输出:{"demandCode":"%s"}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取返利明细中demandCode
result = {"demandCode": result["data"][0]["demandCode"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict26", demand_code)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc需求单销售合同下载功能验证,2289,2289-23,sit,bs
涉及到接口:多采商城需求单销售合同下载接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
from common.handle_excel import HandleExcel
import requests
import random
import json
import os
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload22_1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_id = result["data"]["list"][random_demand]["demandId"]
# demand_id = "40187"
demand_code = result["data"]["list"][random_demand]["demandCode"]
# 第三步进行需求单销售合同下载
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url22")
request_body = commonFuc().get_business_data(module, "payload22", demand_id)
# print(request_body)
"""
场景: 需求单销售合同下载功能验证
用例名称:需求单销售合同下载功能验证
输出:{"demandCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
# result = json.loads(result.content)
# print(result)
# 获取文件
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
file_path = BASE_DIR + "/data/cmdc_files/销售合同导出.xlsx"
# 获取到导出文件存入cmdc_files文件中
with open(file_path, 'wb') as f:
f.write(result.content)
# 获取销售合同文件中合同编号
excel = HandleExcel(file_path, "Sheet1")
result = {"demandCode": excel.read_data()[0].get("医疗器械产品销售合同 ")[-17:]}
print(excel.read_data()[0].get("医疗器械产品销售合同 "))
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict22", demand_code)
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc验证订单占用功能,2289,2289-21,sit,bs
涉及到接口:多采商城验证订单是否被占用接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_id = result["data"]["list"][random_demand]["demandId"]
# demand_id = "40187"
# 第三步判断需求单是否被占用
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url19")
request_body = commonFuc().get_business_data(module, "payload19", demand_id)
# print(request_body)
"""
场景: 验证订单占用功能
用例名称:验证订单占用功能
输出:{"success":true,"code":"200","message":"请求成功,展示操作流水"}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict19")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc验证订单是否已支付,2289,2289-35,sit,bs
涉及到接口:多采商城获取订单支付状态接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import random
import json
module = "cmdc_demand_mall"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
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)
# 第二步获取需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
demand_parent_code = result["data"]["list"][random_demand]["demandParentCode"]
proof_sign = result["data"]["list"][random_demand]["proofSign"]
# 第三步在需求单列表进行需求单查询操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url36")
request_body = commonFuc().get_business_data(module, "payload36", demand_parent_code)
# print(request_body)
"""
场景: 验证订单是否已支付
用例名称:验证订单是否已支付
输出:{"success":true,"code":"200","message":"OK","data":0}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
if proof_sign:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict36")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict36_1")
# 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