Commit 08d50973 authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent 03d38900
......@@ -17,8 +17,8 @@ module = "cmdc_order_handle"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
username = commonFuc().get_business_data(module, "username2")
password = commonFuc().get_business_data(module, "password2")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
......@@ -32,7 +32,7 @@ host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
amount_product = float(random.randint(100, 1000))
# print(amount_product)
# 进行商品金额调整操作
sql = "UPDATE `cmdc-product`.ic_product t SET t.referencePrice = {} WHERE t.productId = 7991".format(amount_product)
sql = "UPDATE `cmdc-product`.ic_product t SET t.referencePrice = {} WHERE t.productId = 9184".format(amount_product)
mysql_handle.executeUpdate(host, port, user, pwd, "cmdc-product", sql)
# 第二步进行提交订单
......@@ -42,7 +42,7 @@ request_body = commonFuc().get_business_data(module, "payload19")
"""
场景: 验证进行订单提交时,修改商品金额,订单是否按修改前商品金额计算
用例名称:商品金额调整验证_下单
输出:{"productAmount":"48.25"}
输出:{"productAmount":"720.38"}
"""
# 发送请求
......@@ -51,10 +51,11 @@ result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
result = json.loads(result.content)
# print(result)
result["api_time"] = api_time
if result["success"]:
# 获取订单中商品金额
result = {"productAmount": result["data"]["国药集团上海医疗器械有限公司"]["productAmount"]}
result = {"productAmount": result["data"]["国药集团联合医疗器械有限公司"]["productAmount"]}
result["api_time"] = api_time
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict22")
......
......@@ -18,8 +18,8 @@ module = "cmdc_order_handle"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
username = commonFuc().get_business_data(module, "username2")
password = commonFuc().get_business_data(module, "password2")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
......@@ -33,11 +33,11 @@ host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
amount_product = float(random.randint(100, 1000))
# print(amount_product)
# 进行商品金额调整操作
sql = "UPDATE `cmdc-product`.ic_product t SET t.referencePrice = {} WHERE t.productId = 7991".format(amount_product)
sql = "UPDATE `cmdc-product`.ic_product t SET t.referencePrice = {} WHERE t.productId = 9184".format(amount_product)
mysql_handle.executeUpdate(host, port, user, pwd, "cmdc-product", sql)
# 查询指定需求单信息
order_num = "17018438457347575"
order_num = "17071033368805325"
# 第二步获取多采商城需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url_demand_list")
......@@ -69,7 +69,7 @@ result["api_time"] = api_time
# print(result)
if result["success"]:
# 获取订单中商品金额
result = {"productAmount": result["data"]["国药集团上海医疗器械有限公司"]["datas"][0]["productAmount"]}
result = {"productAmount": result["data"]["国药集团联合医疗器械有限公司"]["datas"][0]["productAmount"]}
result["api_time"] = api_time
# print(result)
# 获取预期结果
......
......@@ -16,8 +16,8 @@ module = "cmdc_order_handle"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
username = commonFuc().get_business_data(module, "username2")
password = commonFuc().get_business_data(module, "password2")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
......@@ -28,7 +28,7 @@ mysql_handle = mySql()
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 进行商品控销操作
sql = "UPDATE `cmdc-product`.ic_product t SET t.isControlSales = 1 WHERE t.productId = 7991"
sql = "UPDATE `cmdc-product`.ic_product t SET t.isControlSales = 1 WHERE t.productId = 9184"
mysql_handle.executeUpdate(host, port, user, pwd, "cmdc-product", sql)
# 第二步进行提交订单
......
......@@ -16,8 +16,8 @@ module = "cmdc_order_handle"
# 第一步登录多采商城获取token
# 获取登录所需账号密码
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password")
username = commonFuc().get_business_data(module, "username2")
password = commonFuc().get_business_data(module, "password2")
# 获取登录后Cmdc_access_token
cmdc_access_token = CmdcMaiiLogin(username, password).get_token()
headers = commonFuc().get_business_data(module, "json_headers1", cmdc_access_token)
......@@ -28,7 +28,7 @@ mysql_handle = mySql()
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 查询指定需求单信息
order_num = "17018438457347575"
order_num = "17071033368805325"
# 第二步获取多采商城需求单列表
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url_demand_list")
......@@ -64,5 +64,5 @@ check_dict = commonFuc().get_business_data(module, "checkDict20")
commonFuc().check_result(check_dict, result)
# 进行去除商品控销状态操作
sql = "UPDATE `cmdc-product`.ic_product t SET t.isControlSales = 0 WHERE t.productId = 7991"
sql = "UPDATE `cmdc-product`.ic_product t SET t.isControlSales = 0 WHERE t.productId = 9184"
mysql_handle.executeUpdate(host, port, user, pwd, "cmdc-product", sql)
......@@ -201,7 +201,7 @@ checkDict21: {"productAmount":"%s"}
#验证进行订单提交时,修改商品金额,订单是否按修改前商品金额计算
#预期结果
checkDict22: {"productAmount":"48.25"}
checkDict22: {"productAmount":"720.38"}
#测试场景二十三:获取收款账号接口验证
......
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