An error occurred while loading the file. Please try again.
An error occurred while loading the file. Please try again.
An error occurred while loading the file. Please try again.
-
liguangyu06 authored26149ed2
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc站点无法快速下单,2250,2250-1,sit,bs
主数据平台:多采商城快速下单权限判定接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.多采商城登录.多采商城登录 import CmdcMaiiLogin
import requests
import json
module = "cmdc-qos"
# 第一步登录多采商城获取cmdc_access_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_headers", cmdc_access_token)
# 第二步查询站点对应的companyId
url1 = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body1 = commonFuc().get_business_data(module, "payload1")
result1 = requests.post(url1, json=request_body1, headers=headers)
result1 = json.loads(result1.text)
"""
场景:站点不拥有快速下单权限入口
用例名称:快速下单权限判定接口-站点满足条件显示快速下单入口
输入:companyId
输出:"quickOrderSign": 0
"""
# 获取站点对应的快速下单标识字段quickOrderSign
result1 = result1["data"]
for i in result1:
quick_order_sign = i["quickOrderSign"]
# 第三步验证站点是否具有快速下单权限
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url")
if quick_order_sign == 0:
# 获取companyId
company_id = i["companyId"]
request_body = commonFuc().get_business_data(module, "payload", company_id)
result = requests.get(url, params=request_body)
result = json.loads(result.text)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict2")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
break
else:
# 获取companyId
company_id = i["companyId"]
request_body = commonFuc().get_business_data(module, "payload", company_id)
result = requests.get(url, params=request_body)
result = json.loads(result.text)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict1")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
break
71