Commit 7c524136 authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent a56310c0
......@@ -26,7 +26,7 @@ headers = commonFuc().get_business_data(module, "json_headers2", cmdc_access_tok
# 第二步特价单品列表查询
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1")
request_body = commonFuc().get_business_data(module, "payload1")
request_body = commonFuc().get_business_data(module, "payload_close")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
......@@ -59,7 +59,7 @@ files = {"file": file}
# 发送请求
result = requests.post(url, files=files, headers=headers, data=request_body)
result = json.loads(result.content)
print(result)
# 导入成功后获取对应的套包id
group_id = result["data"]["freseniusAgreementPrices"][0]["groupId"]
fresenius_price_id = result["data"]["freseniusAgreementPrices"][0]["freseniusPriceId"]
......@@ -67,7 +67,7 @@ fresenius_price_id = result["data"]["freseniusAgreementPrices"][0]["freseniusPri
# 第三步进行特价单品删除操作
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url_open")
request_body = {"freseniusPriceIds": [fresenius_price_id], "groupPriceStatus": 1, "remarks": "特价单品启用"}
print(request_body)
"""
场景:启用_批量_特价单品
用例名称:启用_批量_特价单品
......@@ -87,8 +87,9 @@ host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 数据库查询特价单品数量
sql = "SELECT t.groupPriceStatus FROM `cmdc-order`.tc_fresenius_agreement_price t WHERE groupId = {};".format(group_id)
print(sql)
result = {"groupPriceStatus": mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql)[0][0]}
print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict18")
# 断言实际结果中是否包含预期结果的内容
......
......@@ -15,6 +15,7 @@ from common.db.db import mySql
import random
import requests
import json
import uuid
module = "cmdc_special_fresenius_group"
......@@ -34,7 +35,9 @@ result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# 生成随机数
customer_quantity = random.randint(1, len(result["data"]["list"]))
customer_quantity = random.randint(1, len(result["data"]["list"])-1)
# 随机生成唯一字符串用于ref
ref_random = str(uuid.uuid4())
# 客户信息获取
customer_code = result["data"]["list"][customer_quantity]["customerCode"]
customer_name = result["data"]["list"][customer_quantity]["customerName"]
......@@ -68,7 +71,7 @@ url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url17")
request_body = {"manufacturerGroupName": "", "manufacturerGroupCode": "", "groupName": "", "limitPurchase": "",
"isLimit": 0, "products": [product_detail], "customerCode": customer_code, "userName": user_name,
"customerName": customer_name, "times": [str(start_date), str(random_date)],
"documentNo": customer_quantity,
"documentNo": ref_random,
"supplementNo": customer_quantity, "salesProvince": customer_quantity, "salesArea": customer_quantity,
"applicationType": customer_quantity, "effectiveTime": str(start_date),
"expirationTime": str(random_date),
......@@ -83,7 +86,7 @@ request_body = {"manufacturerGroupName": "", "manufacturerGroupCode": "", "group
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 数据库操作
mysql_handle = mySql()
# 获取conf.ini文件中配置的数据库信息
......@@ -91,7 +94,8 @@ host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 数据库查询新增特价单品
sql = "SELECT t.groupId FROM `cmdc-order`.tc_fresenius_agreement_price t " \
"WHERE customerCode = {} and documentNo = {};".format(customer_code, customer_quantity)
"WHERE customerCode = {} and documentNo = '{}';".format(customer_code, ref_random)
print(sql)
total = len(mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql))
result = {"total": total}
......
......@@ -150,6 +150,8 @@ checkDict17: {"total": 1}
#测试场景:特价单品批量启用
#特价单品查询-停用状态
"payload_close": {"groupCode":"","groupName":"","productCode":"","productInfo":"","materialCode":"","manufacturerList":[],"productLineName":"","description":"","manufacturerProductDesc":"","manufacturerProductNo":"","customerCode":"","customerName":"","manufacturerUserNo":"","manufacturerUserDesc":"","documentNo":"","groupType":1,"groupPriceStatus":"0","pageStart":1,"pageSize":10}
#excel导入接口和报文
"url18": "/order/public/importEnableOrDisableSingleProduct"
"payload18": {"groupPriceStatus": 1}
......
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