From 63fee06af0733ab7657c6bfd49235b4af38ccbc6 Mon Sep 17 00:00:00 2001 From: liguangyu06 <1666071293@qq.com> Date: Mon, 15 Apr 2024 11:30:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E4=BE=8B=E6=96=B0=E5=A2=9E=EF=BC=9A?= =?UTF-8?q?=E7=94=B5=E5=95=86=E4=B8=8B=E5=8D=95=E6=97=B6=E9=97=B4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=8A=9F=E8=83=BD=E9=AA=8C=E8=AF=81=5F=E9=94=80?= =?UTF-8?q?=E5=94=AE=E6=98=8E=E7=BB=86=E5=88=97=E8=A1=A8=5F=E9=99=8D?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7\350\241\250_\351\231\215\345\272\217.py" | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 "air_case/cmdc_34st/\347\224\265\345\225\206\344\270\213\345\215\225\346\227\266\351\227\264\346\216\222\345\272\217\345\212\237\350\203\275\351\252\214\350\257\201_\351\224\200\345\224\256\346\230\216\347\273\206\345\210\227\350\241\250_\351\231\215\345\272\217.air/\347\224\265\345\225\206\344\270\213\345\215\225\346\227\266\351\227\264\346\216\222\345\272\217\345\212\237\350\203\275\351\252\214\350\257\201_\351\224\200\345\224\256\346\230\216\347\273\206\345\210\227\350\241\250_\351\231\215\345\272\217.py" diff --git "a/air_case/cmdc_34st/\347\224\265\345\225\206\344\270\213\345\215\225\346\227\266\351\227\264\346\216\222\345\272\217\345\212\237\350\203\275\351\252\214\350\257\201_\351\224\200\345\224\256\346\230\216\347\273\206\345\210\227\350\241\250_\351\231\215\345\272\217.air/\347\224\265\345\225\206\344\270\213\345\215\225\346\227\266\351\227\264\346\216\222\345\272\217\345\212\237\350\203\275\351\252\214\350\257\201_\351\224\200\345\224\256\346\230\216\347\273\206\345\210\227\350\241\250_\351\231\215\345\272\217.py" "b/air_case/cmdc_34st/\347\224\265\345\225\206\344\270\213\345\215\225\346\227\266\351\227\264\346\216\222\345\272\217\345\212\237\350\203\275\351\252\214\350\257\201_\351\224\200\345\224\256\346\230\216\347\273\206\345\210\227\350\241\250_\351\231\215\345\272\217.air/\347\224\265\345\225\206\344\270\213\345\215\225\346\227\266\351\227\264\346\216\222\345\272\217\345\212\237\350\203\275\351\252\214\350\257\201_\351\224\200\345\224\256\346\230\216\347\273\206\345\210\227\350\241\250_\351\231\215\345\272\217.py" new file mode 100644 index 00000000..e027517f --- /dev/null +++ "b/air_case/cmdc_34st/\347\224\265\345\225\206\344\270\213\345\215\225\346\227\266\351\227\264\346\216\222\345\272\217\345\212\237\350\203\275\351\252\214\350\257\201_\351\224\200\345\224\256\346\230\216\347\273\206\345\210\227\350\241\250_\351\231\215\345\272\217.air/\347\224\265\345\225\206\344\270\213\345\215\225\346\227\266\351\227\264\346\216\222\345\272\217\345\212\237\350\203\275\351\252\214\350\257\201_\351\224\200\345\224\256\346\230\216\347\273\206\345\210\227\350\241\250_\351\231\215\345\272\217.py" @@ -0,0 +1,60 @@ +# -*- encoding=utf8 -*- +__author__ = "liguangyu" + +""" +case_tag:cmdc_api,cmdc电商下单时间排序功能验证_销售明细列表_降序,34,34-10,sit,be +主数据平台:后台运营系统销售明细列表接口 +""" + +from common.common_func import commonFuc +from air_case.cmdc_login.后台管理系统登录.后台管理系统登录 import CmdcDoLogin +from common.db.db import mySql +import requests +import json + +module = "cmdc_34st" + +# 第一步登录后台运营系统获取token +username = commonFuc().get_business_data(module, "username_do_be") +password = commonFuc().get_business_data(module, "password_do_be") +# 获取登录后Cmdc_access_token +cmdc_access_token = CmdcDoLogin(username, password).get_token() +headers = commonFuc().get_business_data(module, "json_headers", cmdc_access_token) + +# 第二步按电商下单时间降序排列 +url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url10") +request_body = commonFuc().get_business_data(module, "payload10") + +""" + + 场景: 电商下单时间排序功能验证_销售明细列表_降序 + 用例名称:电商下单时间排序功能验证_销售明细列表_降序 + 输出:{"demandParentCode":"%s"} +""" + +# 发送请求 +result = requests.post(url, json=request_body, headers=headers) +# 获取接口响应时间 +api_time = float(result.elapsed.total_seconds()) + +# 获取销售明细列表 +result = json.loads(result.content) +result = {"demandParentCode": result["data"]["list"][0]["demandParentCode"]} +# 将接口响应时间添加至result +result["api_time"] = api_time + +# 数据库操作 +mysql_handle = mySql() +# 获取conf.ini文件中配置的数据库信息 +host, port, user, pwd = mysql_handle.getConf(db="cmdc_db_be") + +# 在数据库中按电扇下单时间降序查询对应的销售明细信息 +sql = "select * from (select main.demandParentCode,subtd.sellerCompanyCode as companyCode,subtd.sellerCompanyName,subtd.demandCode,td.createTime,td.auditTime,subtd.distributionType,td.paymentType, main.paidTime,jd.SDDOCO as soCode,jd.SDTRDJ, subtd.customerCode,subtd.customerName,subsku.productCode,subsku.productName, subsku.materialCode,subsku.optionStr,subsku.manufacturer,subtd.productLineCode,subtd.productLineName,subsku.measuringUnit,subsku.sendQuantity,jd.DTTUPRC,jd.DTTAEXP,jd.SDUPRC,jd.SDAEXP, jd.IOLOT1,jd.SDLOTN,jd.FCD01,jd.IOMMEJ ,jd.SDADDJ,jd.SDDCTO ,jd.SDSOQS, jd.QWDSC, jd.SDPMPN, subsku.price, subsku.promotionPrice, (subsku.realPay/subsku.quantity) as realUnitPrice, subsku.price*jd.SDSOQS as originalTotalAmount, subsku.promotionPrice*jd.SDSOQS as rebateTotalAmount, (subsku.realPay/subsku.quantity)*jd.SDSOQS as realTotalAmount, subsku.manufacturerUserNo,subsku.manufacturerUserDesc,subsku.manufacturerProductNo,subsku.manufacturerProductDesc, if(subsku.manufacturerUserNo is not null,if(mu.id is null,1,0),0) as manufacturerUserDeleteSign, if(subsku.manufacturerProductNo is not null,if(mp.id is null,1,0),0) as manufacturerProductDeleteSign from tc_jde_580_jde jd inner join tc_demand_sub_sku subsku on jd.demandSubCode = subsku.demandSubCode and jd.SDKCOO = subsku.sellerCompanyCode and jd.SDLTTR < 980 and jd.subLineNumber = subsku.subLineNumber inner join tc_demand_sub subtd on subsku.demandSubCode = subtd.demandSubCode inner join tc_demand td on jd.demandCode = td.demandCode inner join tc_demand_main main on subsku.demandParentId = main.demandParentId left join tc_manufacturer_user mu on mu.id = subsku.manufacturerUserId left join tc_manufacturer_product mp on mp.id = subsku.manufacturerProductId where subtd.demandId is not null and subtd.sellerCompanyCode = '00102' order by td.createTime desc) tmp_count order by createTime desc" +demandParentCode = mysql_handle.selectSql(host, port, user, pwd, "cmdc-order", sql)[0][0] + +# 获取预期结果 +check_dict = commonFuc().get_business_data(module, "checkDict10", demandParentCode) +# print(check_dict) +# 断言实际结果中是否包含预期结果的内容 +commonFuc().check_result(check_dict, result) + -- GitLab