test_entranceFeeBill_provesPage.py 5.2 KB
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import unittest
import urllib3
from commons import ConfigDB as db
from commons.MySession import my,sy1
from commons.api.sy.entranceFeeBill_provesPage import entranceFeeBill_provesPage
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
en=entranceFeeBill_provesPage()


class test_entranceFeeBill_provesPage(unittest.TestCase):
    "沈阳市场-进门收费管理-证明类型明细"

    @classmethod
    def setUpClass(cls):
        cls.data=db.mysql_selectOne(en.sql_select(sy1.user["sy_user01"]["firmId"]))
        print(cls.data)


    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_provesPage_01(self):
        "证明类型明细-查询:查询条件为“收费单号”,其余查询条件输入合法值,查询一条指定数据"
        body= ((en.body.replace("202108110900139", self.data[1]).
                replace("14436", str(self.data[9])).
                replace("雪莲果", self.data[11]).replace("14158", str(self.data[10])).
                replace("103", str(self.data[0]))).replace("1621",str(self.data[8]))).replace(
            "companyId=9","companyId={}".format(str(self.data[6])))
        re=sy1.post(url=en.url,headers=en.header,data=body.encode("utf-8"))
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'total':1" in str(re.json()).replace(" ",""))
        self.assertTrue("'number':'{}'".format(self.data[1]) in str(re.json()).replace(" ",""))

    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_provesPage_02(self):
        "证明类型明细-查询:查询条件为“车号”,其余查询条件输入合法值,查询一条指定数据"
        body= ((en.body.replace("number", "likePlate").
                replace("202108110900139",self.data[2]).
                replace("14436", str(self.data[9])).
                replace("雪莲果", self.data[11]).
                replace("14158", str(self.data[10])).
                replace("103", str(self.data[0]))).
                replace("1621",str(self.data[8]))).\
                replace("companyId=9","companyId={}".format(str(self.data[6])))
        re=sy1.post(url=en.url,headers=en.header,data=body.encode("utf-8"))
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'number':'{}'".format(self.data[1]) in str(re.json()).replace(" ",""))

    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_provesPage_03(self):
        "证明类型明细-查询:查询条件为“客户姓名”,其余查询条件输入合法值,查询一条指定数据"
        body= ((en.body.replace("number", "cname").
                replace("202108110900139",self.data[3]).
                replace("14436", str(self.data[9])).
                replace("雪莲果", self.data[11]).
                replace("14158", str(self.data[10])).
                replace("103", str(self.data[0]))).
                replace("1621",str(self.data[8]))).\
                replace("companyId=9","companyId={}".format(str(self.data[6])))
        re=sy1.post(url=en.url,headers=en.header,data=body.encode("utf-8"))
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'number':'{}'".format(self.data[1]) in str(re.json()).replace(" ",""))

    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_provesPage_04(self):
        "证明类型明细-查询:查询条件为“客户卡号”,其余查询条件输入合法值,查询一条指定数据"
        body= ((en.body.replace("number", "ic").
                replace("202108110900139",self.data[5]).
                replace("14436", str(self.data[9])).
                replace("雪莲果", self.data[11]).
                replace("14158", str(self.data[10])).
                replace("103", str(self.data[0]))).
                replace("1621",str(self.data[8]))).\
                replace("companyId=9","companyId={}".format(str(self.data[6])))
        re=sy1.post(url=en.url,headers=en.header,data=body.encode("utf-8"))
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'number':'{}'".format(self.data[1]) in str(re.json()).replace(" ",""))

    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_provesPage_05(self):
        "证明类型明细-查询:查询条件为“手机号”,其余查询条件输入合法值,查询一条指定数据"
        body = ((en.body.replace("number", "phone").
                 replace("202108110900139", self.data[4]).
                 replace("14436", str(self.data[9])).
                 replace("雪莲果", self.data[11]).
                 replace("14158", str(self.data[10])).
                 replace("103", str(self.data[0]))).
                replace("1621", str(self.data[8]))). \
            replace("companyId=9", "companyId={}".format(str(self.data[6])))
        re = sy1.post(url=en.url, headers=en.header, data=body.encode("utf-8"))
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'number':'{}'".format(self.data[1]) in str(re.json()).replace(" ", ""))

if __name__ == "__main__":

    unittest.main(verbosity=2)
    # com.run_one(test_entranceFeeBill_provesPage("test_entranceFeeBill_provesPage_04"))