Commit 2ebfcbcd1e577069251bea16ddf8ba0a49ef4185
1 parent
3427cdef
上传证明类型接口的测试用例
Showing
2 changed files
with
115 additions
and
12 deletions
commons/api/entranceFeeBill_provesPage.py
@@ -29,18 +29,18 @@ class entranceFeeBill_provesPage(): | @@ -29,18 +29,18 @@ class entranceFeeBill_provesPage(): | ||
29 | self.header = entranceFeeBill_provesPage.header | 29 | self.header = entranceFeeBill_provesPage.header |
30 | self.body= entranceFeeBill_provesPage.body.replace('\n', '') | 30 | self.body= entranceFeeBill_provesPage.body.replace('\n', '') |
31 | self.sql="""SELECT | 31 | self.sql="""SELECT |
32 | - a.dep, | ||
33 | - a.number, | ||
34 | - a.plate, | ||
35 | - a.customer_name, | ||
36 | - a.customer_phone, | ||
37 | - a.ic, | ||
38 | - a.company_id, | ||
39 | - a.goods_id, | ||
40 | - b.prove_type_code, | ||
41 | - b.category_id, | ||
42 | - b.product_id, | ||
43 | - b.product_name , | 32 | + a.dep, #部门 |
33 | + a.number, #收费单号 | ||
34 | + a.plate, #车牌号 | ||
35 | + a.customer_name, #客户姓名 | ||
36 | + a.customer_phone, #客户电话 | ||
37 | + a.ic, #客户卡号 | ||
38 | + a.company_id, #子公司 | ||
39 | + a.goods_id, | ||
40 | + b.prove_type_code, #证明类型 | ||
41 | + b.category_id, #品类id | ||
42 | + b.product_id, #商品id | ||
43 | + b.product_name , #商品名称 | ||
44 | c.fee_bill_id | 44 | c.fee_bill_id |
45 | FROM entrance_fee_bill a ,goods b ,bill_fee_item c | 45 | FROM entrance_fee_bill a ,goods b ,bill_fee_item c |
46 | WHERE a.goods_id=b.id | 46 | WHERE a.goods_id=b.id |
testcase/entranceFeeBill_proves/test_entranceFeeBill_provesPage.py
0 → 100644
1 | +#!/usr/bin/python | ||
2 | +# -*- coding: UTF-8 -*- | ||
3 | +import unittest | ||
4 | +import urllib3 | ||
5 | +from commons import ConfigDB as db | ||
6 | +from commons import common as com | ||
7 | +from commons.MySession import my,sy1 | ||
8 | +from commons.api.entranceFeeBill_provesPage import entranceFeeBill_provesPage | ||
9 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
10 | +en=entranceFeeBill_provesPage() | ||
11 | + | ||
12 | + | ||
13 | +class test_entranceFeeBill_provesPage(unittest.TestCase): | ||
14 | + "证明类型明细" | ||
15 | + | ||
16 | + @classmethod | ||
17 | + def setUpClass(cls): | ||
18 | + cls.data=db.mysql_selectOne(en.sql) | ||
19 | + print(cls.data) | ||
20 | + | ||
21 | + | ||
22 | + @unittest.case_mark(my.mark()) | ||
23 | + def test_entranceFeeBill_provesPage_01(self): | ||
24 | + "证明类型明细-查询:查询条件为“收费单号”,其余查询条件输入合法值,查询一条指定数据" | ||
25 | + body= ((en.body.replace("202108110900139", self.data[1]). | ||
26 | + replace("14436", str(self.data[9])). | ||
27 | + replace("雪莲果", self.data[11]).replace("14158", str(self.data[10])). | ||
28 | + replace("103", str(self.data[0]))).replace("1621",str(self.data[8]))).replace( | ||
29 | + "companyId=9","companyId={}".format(str(self.data[6]))) | ||
30 | + re=sy1.post(url=en.url,headers=en.header,data=body.encode("utf-8")) | ||
31 | + print(re.json()) | ||
32 | + self.assertEqual(re.status_code, 200) | ||
33 | + self.assertTrue("'total':1" in str(re.json()).replace(" ","")) | ||
34 | + self.assertTrue("'number':'{}'".format(self.data[1]) in str(re.json()).replace(" ","")) | ||
35 | + | ||
36 | + @unittest.case_mark(my.mark()) | ||
37 | + def test_entranceFeeBill_provesPage_02(self): | ||
38 | + "证明类型明细-查询:查询条件为“车号”,其余查询条件输入合法值,查询一条指定数据" | ||
39 | + body= ((en.body.replace("number", "likePlate"). | ||
40 | + replace("202108110900139",self.data[2]). | ||
41 | + replace("14436", str(self.data[9])). | ||
42 | + replace("雪莲果", self.data[11]). | ||
43 | + replace("14158", str(self.data[10])). | ||
44 | + replace("103", str(self.data[0]))). | ||
45 | + replace("1621",str(self.data[8]))).\ | ||
46 | + replace("companyId=9","companyId={}".format(str(self.data[6]))) | ||
47 | + re=sy1.post(url=en.url,headers=en.header,data=body.encode("utf-8")) | ||
48 | + print(re.json()) | ||
49 | + self.assertEqual(re.status_code, 200) | ||
50 | + self.assertTrue("'number':'{}'".format(self.data[1]) in str(re.json()).replace(" ","")) | ||
51 | + | ||
52 | + @unittest.case_mark(my.mark()) | ||
53 | + def test_entranceFeeBill_provesPage_03(self): | ||
54 | + "证明类型明细-查询:查询条件为“客户姓名”,其余查询条件输入合法值,查询一条指定数据" | ||
55 | + body= ((en.body.replace("number", "cname"). | ||
56 | + replace("202108110900139",self.data[3]). | ||
57 | + replace("14436", str(self.data[9])). | ||
58 | + replace("雪莲果", self.data[11]). | ||
59 | + replace("14158", str(self.data[10])). | ||
60 | + replace("103", str(self.data[0]))). | ||
61 | + replace("1621",str(self.data[8]))).\ | ||
62 | + replace("companyId=9","companyId={}".format(str(self.data[6]))) | ||
63 | + re=sy1.post(url=en.url,headers=en.header,data=body.encode("utf-8")) | ||
64 | + print(re.json()) | ||
65 | + self.assertEqual(re.status_code, 200) | ||
66 | + self.assertTrue("'number':'{}'".format(self.data[1]) in str(re.json()).replace(" ","")) | ||
67 | + | ||
68 | + @unittest.case_mark(my.mark()) | ||
69 | + def test_entranceFeeBill_provesPage_04(self): | ||
70 | + "证明类型明细-查询:查询条件为“客户卡号”,其余查询条件输入合法值,查询一条指定数据" | ||
71 | + body= ((en.body.replace("number", "ic"). | ||
72 | + replace("202108110900139",self.data[5]). | ||
73 | + replace("14436", str(self.data[9])). | ||
74 | + replace("雪莲果", self.data[11]). | ||
75 | + replace("14158", str(self.data[10])). | ||
76 | + replace("103", str(self.data[0]))). | ||
77 | + replace("1621",str(self.data[8]))).\ | ||
78 | + replace("companyId=9","companyId={}".format(str(self.data[6]))) | ||
79 | + re=sy1.post(url=en.url,headers=en.header,data=body.encode("utf-8")) | ||
80 | + print(re.json()) | ||
81 | + self.assertEqual(re.status_code, 200) | ||
82 | + self.assertTrue("'number':'{}'".format(self.data[1]) in str(re.json()).replace(" ","")) | ||
83 | + | ||
84 | + @unittest.case_mark(my.mark()) | ||
85 | + def test_entranceFeeBill_provesPage_05(self): | ||
86 | + "证明类型明细-查询:查询条件为“手机号”,其余查询条件输入合法值,查询一条指定数据" | ||
87 | + body = ((en.body.replace("number", "phone"). | ||
88 | + replace("202108110900139", self.data[4]). | ||
89 | + replace("14436", str(self.data[9])). | ||
90 | + replace("雪莲果", self.data[11]). | ||
91 | + replace("14158", str(self.data[10])). | ||
92 | + replace("103", str(self.data[0]))). | ||
93 | + replace("1621", str(self.data[8]))). \ | ||
94 | + replace("companyId=9", "companyId={}".format(str(self.data[6]))) | ||
95 | + re = sy1.post(url=en.url, headers=en.header, data=body.encode("utf-8")) | ||
96 | + print(re.json()) | ||
97 | + self.assertEqual(re.status_code, 200) | ||
98 | + self.assertTrue("'number':'{}'".format(self.data[1]) in str(re.json()).replace(" ", "")) | ||
99 | + | ||
100 | +if __name__ == "__main__": | ||
101 | + | ||
102 | + unittest.main(verbosity=2) | ||
103 | + # com.run_one(test_entranceFeeBill_provesPage("test_entranceFeeBill_provesPage_01")) |