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

Merge branch 'master' into 'main'

Master|需求单模块归档合并

See merge request !4
parents c9176154 d067bf09
...@@ -19,25 +19,22 @@ username = commonFuc().get_business_data(module, "username") ...@@ -19,25 +19,22 @@ username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password") password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token # 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token() cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
# 第二步查询站点对应的companyId # 第二步查询站点对应的companyId
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1") url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body1 = commonFuc().get_business_data(module, "payload1") request_body1 = commonFuc().get_business_data(module, "payload1")
result1 = requests.post(url1, json=request_body1, headers=headers)
result1 = json.loads(result1.text)
""" """
场景:站点不拥有快速下单权限入口 场景:站点不拥有快速下单权限入口
用例名称:快速下单权限判定接口-站点满足条件显示快速下单入口 用例名称:快速下单权限判定接口-站点满足条件显示快速下单入口
输入:companyId 输入:companyId
输出:"quickOrderSign": 0 输出:"quickOrderSign": 0
""" """
# 发送请求
result1 = requests.post(url1, json=request_body1, headers=headers)
result1 = json.loads(result1.text)
# 获取站点对应的快速下单标识字段quickOrderSign # 获取站点对应的快速下单标识字段quickOrderSign
result1 = result1["data"] result1 = result1["data"]
......
...@@ -73,10 +73,17 @@ request_body = commonFuc().get_business_data(module, "payload30", buyercart_id_1 ...@@ -73,10 +73,17 @@ request_body = commonFuc().get_business_data(module, "payload30", buyercart_id_1
# 发送请求 # 发送请求
result = requests.post(url, json=request_body, headers=headers) result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content) result = json.loads(result.content)
if result["data"]: # print(result)
# # 获取预期结果 if result["success"]:
check_dict = commonFuc().get_business_data(module, "checkDict2") if result["data"]:
# # 断言实际结果中是否包含预期结果的内容 # # 获取预期结果
commonFuc().check_result(check_dict, result) check_dict = commonFuc().get_business_data(module, "checkDict2")
# # 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
print("下单失败")
else: else:
print("下单失败") # 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2_1")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
...@@ -13,7 +13,6 @@ import json ...@@ -13,7 +13,6 @@ import json
module = "cmdc_demand_create_pc" module = "cmdc_demand_create_pc"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
# print(url) # print(url)
# 获取登录所需账号密码 # 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username") username = commonFuc().get_business_data(module, "username")
...@@ -21,6 +20,9 @@ password = commonFuc().get_business_data(module, "password") ...@@ -21,6 +20,9 @@ password = commonFuc().get_business_data(module, "password")
# 获取登录后Cmdc_access_token # 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token() cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token)
# 进行需求单创建操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
request_body = commonFuc().get_business_data(module, "payload") request_body = commonFuc().get_business_data(module, "payload")
""" """
场景:通过快速下单入口提交创建需求单 场景:通过快速下单入口提交创建需求单
...@@ -31,8 +33,15 @@ request_body = commonFuc().get_business_data(module, "payload") ...@@ -31,8 +33,15 @@ request_body = commonFuc().get_business_data(module, "payload")
result = requests.post(url, json=request_body, headers=headers) result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content) result = json.loads(result.content)
# print(result) # print(result)
# 获取预期结果 if result["success"]:
check_dict = commonFuc().get_business_data(module, "checkDict") # 获取预期结果
print(check_dict) check_dict = commonFuc().get_business_data(module, "checkDict")
# 断言实际结果中是否包含预期结果的内容 print(check_dict)
commonFuc().check_result(check_dict, result) # 断言实际结果中是否包含预期结果的内容
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
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc上传支付凭证功能验证,2289,2289-33,sit,bs
涉及到接口:多采商城支付页面附件上传接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
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)
# 获取文件地址
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/test_file.jpg"
# 第二步上传附件
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url34")
# 获取文件
file = open(file_path, "rb")
files = {"file": file}
"""
场景: 上传支付凭证功能验证
用例名称:上传支付凭证功能验证
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.post(url, files=files, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict34")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc商品下架拦截验证_订单修改,2289,2289-37,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")
# 进行商品下架操作
sql = "UPDATE `cmdc-product`.ic_product t SET t.status = 102 WHERE t.productId = 314"
mysql_handle.executeUpdate(host, port, user, pwd, "cmdc-product", sql)
# 第二步需求单编辑修改操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url39")
request_body = commonFuc().get_business_data(module, "payload39")
"""
场景: 验证需求单编辑提交时,所含商品下架,是否被拦截成功
用例名称:商品下架拦截验证_订单修改
输出:{"errMessage": "红外测温仪商品已被下架,请返回重新提交。"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取message
result = {"errMessage": result["data"][0]["errMessage"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict39")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# 进行商品上架架操作
sql = "UPDATE `cmdc-product`.ic_product t SET t.status = 101 WHERE t.productId = 314"
mysql_handle.executeUpdate(host, port, user, pwd, "cmdc-product", sql)
\ No newline at end of file
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc提交订单支付证明功能验证,2289,2289-34,sit,bs
涉及到接口:多采商城提交订单支付证明接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
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)
# 获取文件地址
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/test_file.jpg"
# 第二步上传附件
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url34")
# 获取文件
file = open(file_path, "rb")
files = {"file": file}
# 发送请求
result = requests.post(url, files=files, headers=headers)
result = json.loads(result.content)
# 获取上传附件后地址
file_aliyun = result["data"]
# 第三步提交支付证明信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url35")
request_body = commonFuc().get_business_data(module, "payload35", file_aliyun)
"""
场景: 提交订单支付证明功能验证
用例名称:提交订单支付证明功能验证
输出:{"success":true,"code":"200","message":"OK","data":1}
"""
# 发送请求
result = result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict35")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc查询条件验证_审核变动订单_需求单列表,2289,2289-3,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, "url3")
request_body = commonFuc().get_business_data(module, "payload3")
"""
场景: 验证需求单列表查询条件-审核变动订单,正确性
用例名称:查询条件验证_审核变动订单_需求单列表
输出:{"changeSign":1}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取查询结果中是否审核变动标识
result = {"changeSign": result["data"]["list"][0]["changeSign"]}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict3")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc查询条件验证_状态_需求单列表,2289,2289-4,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, "url4")
request_body = commonFuc().get_business_data(module, "payload4")
"""
场景: 验证需求单列表查询条件-状态,正确性
用例名称:查询条件验证_状态_需求单列表
输出:{"orderStatus":102}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取查询结果中是否审核变动标识
result = {"orderStatus": result["data"]["list"][0]["orderStatus"]}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict4")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc查询条件验证_需求单列表,2289,2289-2,sit,bs
涉及到接口:多采商城需求单列表获取接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import datetime
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)
# 此函数用于当x为none时,进行空字符串替换
def func(x):
if x is None:
x = ""
return x
else:
return x
# 生成随机数
random_demand = random.randint(0, len(result["data"]["list"]) - 1)
# 获取需求单信息
seller_company_code = result["data"]["list"][random_demand]["sellerCompanyCode"]
startTime = result["data"]["list"][random_demand]["createTime"]
endTime = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
product_code = func(result["data"]["list"][random_demand]["productCode"])
product_info_value = func(result["data"]["list"][random_demand]["productName"])
order_num = result["data"]["list"][random_demand]["demandCode"]
payment_type = result["data"]["list"][random_demand]["paymentType"]
preference_type = result["data"]["list"][random_demand]["preferenceType"]
# 第三步在需求单列表进行需求单查询操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url2")
request_body = commonFuc().get_business_data(module, "payload2", seller_company_code, startTime, endTime, product_code,
product_info_value, order_num, payment_type, preference_type)
# print(request_body)
"""
场景: 验证需求单列表查询条件正确性
用例名称:查询条件验证_需求单列表
输出:{"orderNum":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取查询结果中订单编号
result = {"orderNum": result["data"]["list"][0]["demandCode"]}
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2", order_num)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc查询线下支付账号信息验证,2289,2289-32,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)
# 第二步查询线下支付账号信息
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url33")
request_body = commonFuc().get_business_data(module, "payload33")
# print(request_body)
"""
场景: 查询线下支付账号信息验证
用例名称:查询线下支付账号信息验证
输出:{"total":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取账号数量
result = {"total": result["data"]["total"]}
# 数据库操作
mysql_handle = mySql()
# 获取conf.ini文件中配置的数据库信息
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 查询数据库中对应公司对应的账号信息
sql = "SELECT t.accountId FROM `cmdc-cms`.cms_account t WHERE companyId = 7"
total = len(mysql_handle.selectSql(host, port, user, pwd, "cmdc-cms", sql))
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict33", total)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc根据用户查询公司信息验证,2289,2289-29,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, "url30")
request_body = commonFuc().get_business_data(module, "payload30")
# 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, "checkDict30")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc根据需求id获取公司id验证,2289,2289-30,sit,bs
涉及到接口:多采商城验证根据需求id获取公司id接口
"""
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 = "36064"
# 第三步获取公司id
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url32")
request_body = commonFuc().get_business_data(module, "payload32", demand_id)
# print(request_body)
"""
场景: 根据需求id获取公司id验证
用例名称:根据需求id获取公司id验证
输出:{"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, "checkDict32")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc模糊查询生产厂家列表接口验证,2289,2289-7,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)
# 设置需要查询的生产厂家
manufacturer = "A"
# 第二步进行生产厂家模糊查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url7")
request_body = commonFuc().get_business_data(module, "payload7", manufacturer)
"""
场景: 验证获取需求单列表,生产厂家模糊查询接口连通性
用例名称:模糊查询生产厂家列表接口验证
输出:{"data":"%s"}
"""
# 发送请求
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)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取公司站点接口验证,2289,2289-5,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, "url5")
"""
场景: 验证多采商城需求单管理列表,公司站点信息获取接口连通性
用例名称:获取公司站点接口验证
输出:{"success":true,"code":"200","message":"OK"}
"""
# 发送请求
result = requests.get(url)
result = json.loads(result.content)
# print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict5")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取原始需求详情验证,2289,2289-11,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"]
# 第三步在需求单列表进行需求单查询操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url10")
request_body = commonFuc().get_business_data(module, "payload10", demand_code)
# print(request_body)
"""
场景: 获取原始需求详情验证
用例名称:获取原始需求详情验证
输出:{"demandCode":"%s"}
"""
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取原始需求单中demandCode
result = {"demandCode": result["data"]["demandSkuList"]["list"][0]["demandCode"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict10", demand_code)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取审核人员列表验证,2289,2289-10,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"]
# 第三步在需求单列表进行需求单查询操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url9")
request_body = commonFuc().get_business_data(module, "payload9", demand_code)
# print(request_body)
"""
场景: 获取审核人员列表验证
用例名称:获取审核人员列表验证
输出:{"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, "checkDict9")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取支付信息验证_支付页面,2289,2289-31,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-12,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, "url11")
request_body = commonFuc().get_business_data(module, "payload11")
"""
场景: 获取站点信息验证_需求单
用例名称:获取站点信息验证_需求单
输出:{"companyId":6}
"""
# 发送请求
result = requests.get(url, params=request_body)
result = json.loads(result.content)
# 获取站点信息中公司id
result = {"companyId": result["data"]["companyId"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict11")
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取草稿订单详情,2289,2289-38,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, "payload38_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)
# 获取需求单信息
version = result["data"]["list"][random_demand]["version"]
# print(version)
# 第三步获取草稿订单详情
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url38")
request_body = commonFuc().get_business_data(module, "payload38", version)
# print(request_body)
"""
场景: 获取草稿订单详情
用例名称:获取草稿订单详情
输出:{"id":"%s"}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 获取草稿订单详情中id
result = {"id": result["data"]["id"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict38", version)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc获取订单变动明细列表验证,2289,2289-19,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)
"""
场景: 获取订单变动明细列表验证
用例名称:获取订单变动明细列表验证
输出:{"demandSubCode":"%s"}
"""
# 发送请求
result = requests.get(url, params=request_body, headers=headers)
result = json.loads(result.content)
print(result)
if result["data"]:
# 获取订单明细列表中demandCode
result = {"demandCode": result["data"][0]["demandCode"]}
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict16", demand_code)
# print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
else:
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict16_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