From 50d502901eadcc44c368dd72d9bff78d53352816 Mon Sep 17 00:00:00 2001 From: liguangyu06 <1666071293@qq.com> Date: Mon, 29 Jan 2024 17:03:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E4=BE=8B=E6=96=B0=E5=A2=9E=EF=BC=9A?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=9C=80=E6=B1=82=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=5F=E5=90=8E=E5=8F=B0=E8=BF=90=E8=90=A5=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20\350\220\245\347\263\273\347\273\237.py" | 60 +++++++++++++++++++ data/cmdc_order_list/data | 33 ++++++++++ 2 files changed, 93 insertions(+) create mode 100644 "air_case/cmdc_order_list/\350\216\267\345\217\226\351\234\200\346\261\202\345\215\225\345\210\227\350\241\250_\345\220\216\345\217\260\350\277\220\350\220\245\347\263\273\347\273\237.air/\350\216\267\345\217\226\351\234\200\346\261\202\345\215\225\345\210\227\350\241\250_\345\220\216\345\217\260\350\277\220\350\220\245\347\263\273\347\273\237.py" create mode 100644 data/cmdc_order_list/data diff --git "a/air_case/cmdc_order_list/\350\216\267\345\217\226\351\234\200\346\261\202\345\215\225\345\210\227\350\241\250_\345\220\216\345\217\260\350\277\220\350\220\245\347\263\273\347\273\237.air/\350\216\267\345\217\226\351\234\200\346\261\202\345\215\225\345\210\227\350\241\250_\345\220\216\345\217\260\350\277\220\350\220\245\347\263\273\347\273\237.py" "b/air_case/cmdc_order_list/\350\216\267\345\217\226\351\234\200\346\261\202\345\215\225\345\210\227\350\241\250_\345\220\216\345\217\260\350\277\220\350\220\245\347\263\273\347\273\237.air/\350\216\267\345\217\226\351\234\200\346\261\202\345\215\225\345\210\227\350\241\250_\345\220\216\345\217\260\350\277\220\350\220\245\347\263\273\347\273\237.py" new file mode 100644 index 00000000..81ae2611 --- /dev/null +++ "b/air_case/cmdc_order_list/\350\216\267\345\217\226\351\234\200\346\261\202\345\215\225\345\210\227\350\241\250_\345\220\216\345\217\260\350\277\220\350\220\245\347\263\273\347\273\237.air/\350\216\267\345\217\226\351\234\200\346\261\202\345\215\225\345\210\227\350\241\250_\345\220\216\345\217\260\350\277\220\350\220\245\347\263\273\347\273\237.py" @@ -0,0 +1,60 @@ +# -*- encoding=utf8 -*- +__author__ = "liguangyu" + +""" +case_tag:cmdc_api,cmdc获取需求单列表_后台运营系统,31,31-15,sit,bs +主数据平台:多采商城获取需求单列表接口 +""" + +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_order_list" + +# 第一步登录后台运营系统获取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_headers", cmdc_access_token) + +# 第二步获取需求单列表 +url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url1") +request_body = commonFuc().get_business_data(module, "payload1") +# print(request_body) +""" + + 场景: 获取需求单列表_后台运营系统 + 用例名称:获取需求单列表_后台运营系统 + 输出:{"total":"%s"} +""" + +# 发送请求 +result = requests.post(url, json=request_body, headers=headers) +# 获取接口响应时间 +api_time = float(result.elapsed.total_seconds()) + +# 获取需求单数量 +result = json.loads(result.content) +result = {"total": result["data"]["total"]} + +# 将接口响应时间添加至result +result["api_time"] = api_time + +# 数据库操作 +mysql_handle = mySql() +# 获取conf.ini文件中配置的数据库信息 +host, port, user, pwd = mysql_handle.getConf(db="cmdc_db") + +# 查询数据库中需求单数量 +sql = "SELECT count(t.demandId) FROM `cmdc-order`.tc_demand t WHERE deleteSign = 0 and sellerCompanyCode = 00111 and paymentType in (1,2)" +total = mysql_handle.selectSql(host, port, user, pwd, "cmdc-user", sql)[0][0] + +# 获取预期结果 +check_dict = commonFuc().get_business_data(module, "checkDict1", total) +# print(check_dict) +# 断言实际结果中是否包含预期结果的内容 +commonFuc().check_result(check_dict, result) \ No newline at end of file diff --git a/data/cmdc_order_list/data b/data/cmdc_order_list/data new file mode 100644 index 00000000..081c83d3 --- /dev/null +++ b/data/cmdc_order_list/data @@ -0,0 +1,33 @@ +# 多采商城登录信息 +"username": "BJ0621" +"password": "Aa123456" + +#后台运营管理系统登录信息(子站点上海医疗器械有限公司) +"username1": "Admin00111" +"password1": "Aa123456" + + +#后台管理系统headers +json_headers: { + "Content-Type": "application/json", + "Cmdc_access_token": "%s" +} + +#文件上传headers +json_headers_file: { + "Cmdc_access_token": "%s" +} + +#多采商城headers +json_headers1: { + "Cmdc_access_token": "%s", + "Sourcetype": "mall" +} + +#测试场景一:获取需求单列表_后台运营系统 +"url1": "/order/back/listDemand" +"payload1": {"times":[null],"listOrderStatus":[],"productName":null,"demandCode":null,"demandParentCode":null,"customerName":null,"manufacturer":null,"materialCode":null,"sellerCompanyName":null,"produceRegisterNum":null,"productLineName":null,"auditByName":null,"orderSource":null,"changeTypeList":null,"isRebateEdit":null,"jdeType":null,"pageSize":10,"pageStart":1,"orderChangeType":null,"snSgin":null,"changeSign":null,"customerCode":null,"distributionType":null,"busCustomerCode":null,"loginName":null,"cancelSign":0,"shipmentType":null,"siteType":null,"siteCompanyCode":null,"groupQuery":0,"promotionTypeList":[],"isGroup":[],"isReplace":null,"startTime":null,"itemStart":0} +#预期结果 +checkDict1: {"total":"%s"} + + -- GitLab