Commit 7fb5b2fbe11dff10013e32d6bee3cdb2979bafbc

Authored by lixi
1 parent 3f8b4f92

新增称重服务查询接口用例

commons/api/weightBizBill_listPage.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import urllib3
  4 +from commons import common as com
  5 +from commons.MySession import my,sy1
  6 +from commons.basic.duplicateToken import duplicateToken
  7 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  8 +
  9 +
  10 +class weightBizBill_listPage():
  11 + url = "http://test.jmsf.diligrp.com:8385/weightBizBill/listPage.action"
  12 + header = {
  13 + "Connection": "keep-alive",
  14 + "Accept": "application/json, text/javascript, */*; q=0.01",
  15 + "X-Requested-With": "XMLHttpRequest",
  16 + "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36",
  17 + "Content-Type": "application/x-www-form-urlencoded",
  18 + "Accept-Language": "zh-CN,zh;q=0.9",
  19 + "Accept-Encoding": "gzip, deflate"}
  20 + body = '''rows=10&page=1&sort=id&order=desc&metadata[fee]={"provider":"moneyProvider","index":10,"field":
  21 + "fee"}&metadata[created]={"provider":"datetimeProvider","index":20,"field":
  22 + "created"}&metadata[payTime]={"provider":"datetimeProvider","index":30,"field":"payTime"}
  23 + &metadata[status]={"provider":"weightPayStateProvider","index":40,"field":"status"}
  24 + &metadata[refundTime]={"provider":"datetimeProvider","index":50,"field":"refundTime"}
  25 + &metadata[payType]={"provider":"weightPayTypeProvider","index":60,"field":"payType"}
  26 + &attr=number&attrValue=202108030900001&carTypeId=53&depId=139&status=2
  27 + &startCreateDate=2020-08-03 00:00:00&endCreateDate=2029-08-03 23:59:59
  28 + &startPayTime=2020-08-03 00:00:00&endPayTime=2029-08-03 23:59:59'''
  29 +
  30 + def __init__(self):
  31 + self.url = weightBizBill_listPage.url.replace("http://test.", com.get_global_config("global_data", "environment", "en"))
  32 + self.header = weightBizBill_listPage.header
  33 + self.body = weightBizBill_listPage.body.replace('\n', '').replace(' ', '')
  34 +
  35 +
  36 +
  37 +# tt=weightBizBill_listPage()
  38 +# re=sy1.post(url=tt.url,headers=tt.header,json=tt.body,proxies=my.myproxies)
  39 +# print(re.json())
0 40 \ No newline at end of file
... ...
testcase/CZFW/test_doAudit.py deleted 100644 → 0
1   -#!/usr/bin/python
2   -# -*- coding: UTF-8 -*-
3   -import unittest
4   -import urllib3
5   -import commons.ConfigDB as db
6   -from commons import common as com
7   -from commons.MySession import my
8   -from commons.api.fieldConfig import fieldConfig
9   -from commons.api.doAudit import doAudit
10   -from commons.api.doAdd import doAdd
11   -#作用为禁用请求安全提示,平时默认加上上面的urllib3语句就行
12   -urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
13   -ad=doAdd()
14   -au=doAudit()
15   -field=fieldConfig()
16   -
17   -
18   -
19   -class test_doAudit(unittest.TestCase):
20   -
21   - "登记单审核接口"
22   - @classmethod
23   - def setUpClass(cls):
24   - #通过字段配置接口提前配置新增页的字段配置
25   - my.post(url=field.url,headers=field.header,json=field.body)
26   -
27   - def setUp(self):
28   - #准备数据:新增一条登记单
29   - my.post(url=ad.url,headers=ad.header,json=ad.body)
30   - #获取数据:从MYSQL获取新增登记单的id号--因为响应没有id,需要数据库查询
31   - self.code=db.mysql_selectOne("SELECT id FROM `dili_trace`.register_bill ORDER BY id DESC LIMIT 1")[0]
32   - print("db id",self.code)
33   -
34   - @unittest.case_mark(my.mark())
35   - def test_doAudit_01(self):
36   - "审核通过"
37   - #请求url中的需要替换为新增登记单的id
38   - url=au.url.replace("5888", str(self.code))
39   - print("数据处理后的url",url)
40   - #进行GET请求
41   - re=my.get(url=url,headers=au.header)
42   - #打印请求结果(可删除该代码,一般只在调试时使用)
43   - print(re.json())
44   - #断言请求过程是否成功
45   - self.assertEqual(re.status_code, 200)
46   - #断言响应数据中是否存在期望字符串
47   - self.assertTrue("'result':'操作成功'" in str(re.json()).replace(" ",""))
48   -
49   -
50   - @unittest.case_mark(my.mark())
51   - def test_doAudit_02(self):
52   - "审核不通过"
53   - #请求url中的需要替换为新增登记单的id
54   - url=au.url.replace("5888", str(self.code)).replace("verifyStatus=20", "verifyStatus=30")
55   - #进行GET请求
56   - re=my.get(url=url,headers=au.header)
57   - #打印请求结果(可删除该代码,一般只在调试时使用)
58   - print(re.json())
59   - #断言请求过程是否成功
60   - self.assertEqual(re.status_code, 200)
61   - #断言响应数据中是否存在期望字符串
62   - self.assertTrue("'result':'操作成功'" in str(re.json()).replace(" ",""))
63   -
64   -
65   - @unittest.case_mark(my.mark())
66   - def test_doAudit_03(self):
67   - "审核不通过"
68   - #请求url中的需要替换为新增登记单的id
69   - url=au.url.replace("5888", str(self.code)).replace("verifyStatus=20", "verifyStatus=10")
70   - #进行GET请求
71   - re=my.get(url=url,headers=au.header)
72   - #打印请求结果(可删除该代码,一般只在调试时使用)
73   - print(re.json())
74   - #断言请求过程是否成功
75   - self.assertEqual(re.status_code, 200)
76   - #断言响应数据中是否存在期望字符串
77   - self.assertTrue("'result':'操作成功'" in str(re.json()).replace(" ",""))
78   -
79   - @unittest.case_mark(my.mark())
80   - def test_doAudit_04(self):
81   - "审核一个已经完成审核的登记单"
82   - #进行GET请求
83   - re=my.get(url=au.url,headers=au.header)
84   - #打印请求结果(可删除该代码,一般只在调试时使用)
85   - print(re.json())
86   - #断言请求过程是否成功
87   - self.assertEqual(re.status_code, 200)
88   - #断言响应数据中是否存在期望字符串
89   - self.assertTrue("'result':'操作失败,数据状态已改变'" in str(re.json()).replace(" ",""))
90   -
91   - @classmethod
92   - def tearDownClass(cls):
93   - pass
94   -
95   -
96   -if __name__ == "__main__":
97   -
98   - # unittest.main(verbosity=2)
99   -
100   -# com.run_one(test_doAudit("test_doAudit_02"))
101   -
102   - dd=db.mysql_selectOne("SELECT * FROM `dili_trace`.register_bill ORDER BY id DESC LIMIT 1")
103   - print(dd)
104 0 \ No newline at end of file
testcase/CZFW/test_weightBizBill_listPage.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import unittest
  4 +import urllib3
  5 +from commons import common as com
  6 +from commons.MySession import my,sy1
  7 +from commons.api.weightBizBill_listPage import weightBizBill_listPage
  8 +from commons.api.weighingServiceSave import weighingServiceSave
  9 +from commons.basic.listCarType import listCarType
  10 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  11 +bi=weightBizBill_listPage()
  12 +ad=weighingServiceSave(sy1)
  13 +ca=listCarType(sy1)
  14 +
  15 +
  16 +class test_weightBizBill_listPage(unittest.TestCase):
  17 + "称重服务单列表"
  18 +
  19 +
  20 + def setUp(self):
  21 + "数据准备:新增一条称重单"
  22 + body=ad.body.copy()
  23 + body["carTypeId"]=ca.car_list()["data"][0]["id"]
  24 + body["carTypeName"]=ca.car_list()["data"][0]["carTypeName"]
  25 + body["carTypeCode"]=ca.car_list()["data"][0]["code"]
  26 + self.re=sy1.post(url=ad.url,headers=ad.header,json=body)
  27 + print(self.re.json())
  28 +
  29 + @unittest.case_mark(my.mark())
  30 + def test_weightBizBill_listPage_01(self):
  31 + "称重服务单列表-查询:查询条件为“单据编号”,其余查询条件输入合法值,查询一条指定数据"
  32 + body=bi.body.replace("202108030900001",self.re.json()["data"]["number"]).replace(
  33 + "carTypeId=53","carTypeId={}".format(ca.car_list()["data"][0]["id"])).replace(
  34 + "depId=139","depId={}".format(my.user["sy_user01"]["departmentId"]))
  35 + re=sy1.post(url=bi.url,headers=bi.header,data=body)
  36 + print(re.json())
  37 + self.assertEqual(re.status_code, 200)
  38 + self.assertTrue("'total':1" in str(re.json()).replace(" ",""))
  39 + self.assertTrue(self.re.json()["data"]["number"] in str(re.json()).replace(" ",""))
  40 +
  41 +
  42 + @classmethod
  43 + def tearDownClass(cls):
  44 + pass
  45 +
  46 +
  47 +if __name__ == "__main__":
  48 +
  49 + unittest.main(verbosity=2)
  50 +
  51 + # com.run_one(test_weightBizBill_listPage("test_weightBizBill_listPage_01"))
... ...