Commit fc4552f9 authored by liguangyu06's avatar liguangyu06
Browse files

新增套包批量新增用例

parent 193046f0
# -*- encoding=utf8 -*-
__author__ = "liguangyu"
"""
case_tag:cmdc_api,cmdc套包批量新增,2264,2264-7,sit,bs
主数据平台:运营后台管理系统套包批量新增接口
"""
from common.common_func import commonFuc
from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin
import requests
import json
import os
module = "cmdc_fresenius_group"
# 第一步登录后台运营平台获取cmdc_access_token
# 获取登录所需账号密码
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()
headers = commonFuc().get_business_data(module, "json_headers2", 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/套包商品批量维护模板.xlsx"
# 第二步批量新增套包
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url18")
print(url)
request_body = commonFuc().get_business_data(module, "payload18")
# 获取文件
file = open(file_path, "rb")
files = {"file": file}
"""
场景:套包批量新增
用例名称:套包批量新增
输出:{"success":true,"code":"200","message":"OK","data":{"success":true},"freshToken":null}
"""
# 发送请求
result = requests.post(url, files=files, headers=headers, data=request_body)
result = json.loads(result.content)
file.close()
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict18")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
...@@ -13,6 +13,10 @@ json_headers: { ...@@ -13,6 +13,10 @@ json_headers: {
"Cmdc_access_token": "%s" "Cmdc_access_token": "%s"
} }
json_headers2: {
"Cmdc_access_token": "%s"
}
#多采商城headers #多采商城headers
json_headers1: { json_headers1: {
"Cmdc_access_token": "%s", "Cmdc_access_token": "%s",
......
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