test_entranceFeeBill_details.py 8.36 KB
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import unittest
import urllib3
from commons import ConfigDB as db
from commons import common as com
from commons.MySession import my,heb
from commons.api.entranceFeeBill_details import entranceFeeBill_details
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
en=entranceFeeBill_details()


class test_entranceFeeBill_details(unittest.TestCase):
    "哈尔滨市场-进门收费管理-收费单标记"

    @classmethod
    def setUpClass(cls):
        sql=en.sql_select(heb.user["heb_user01"]["firmId"])
        #哈尔滨该页面没有用子公司字段
        sql=sql.replace("AND a.company_id IS NOT NULL","")
        #查询功能模块是否存在响应数据
        cls.data=db.mysql_selectOne(sql)


    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_details_01(self):
        "收费单标记-查询:查询条件为“收费单号”,其余查询条件输入合法值,查询一条指定数据"
        url= en.url.replace("202108120900001", self.data[9]).\
            replace("carTypeId=53", "carTypeId={}".format(self.data[0])).\
            replace("categoryId=14436", "categoryId={}".format(self.data[1])).\
            replace("dep=58", "dep={}".format(self.data[2])).\
            replace("regionId=72", "regionId={}".format(self.data[3])).\
            replace("status=4", "status={}".format(self.data[4])).\
            replace("type=1", "type={}".format(self.data[5])).\
            replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
            replace("&companyId=9","")
        re=heb.get(url=url,headers=en.header,proxies=my.myproxies)
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'total':1" in str(re.json()).replace(" ",""))
        self.assertTrue("'number':'{}'".format(self.data[9]) in str(re.json()).replace(" ",""))

    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_details_02(self):
        "收费单标记-查询:查询条件为“车牌号”,其余查询条件输入合法值,查询一条指定数据"
        url= en.url.replace("202108120900001", self.data[10]).\
            replace("carTypeId=53", "carTypeId={}".format(self.data[0])).\
            replace("categoryId=14436", "categoryId={}".format(self.data[1])).\
            replace("dep=58", "dep={}".format(self.data[2])).\
            replace("regionId=72", "regionId={}".format(self.data[3])).\
            replace("status=4", "status={}".format(self.data[4])).\
            replace("type=1", "type={}".format(self.data[5])).\
            replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
            replace("companyId=9", "").\
            replace("attr=number", "attr=likePlate")
        re=heb.get(url=url,headers=en.header)
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'number':'{}'".format(self.data[9]) in str(re.json()).replace(" ",""))

    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_details_03(self):
        "收费单标记-查询:查询条件为“商品”,其余查询条件输入合法值,查询一条指定数据"
        url= en.url.replace("202108120900001", self.data[11]).\
            replace("carTypeId=53", "carTypeId={}".format(self.data[0])).\
            replace("categoryId=14436", "categoryId={}".format(self.data[1])).\
            replace("dep=58", "dep={}".format(self.data[2])).\
            replace("regionId=72", "regionId={}".format(self.data[3])).\
            replace("status=4", "status={}".format(self.data[4])).\
            replace("type=1", "type={}".format(self.data[5])).\
            replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
            replace("companyId=9", "").\
            replace("attr=number", "attr=goods")
        re=heb.get(url=url,headers=en.header)
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'number':'{}'".format(self.data[9]) in str(re.json()).replace(" ",""))

    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_details_04(self):
        "收费单标记-查询:查询条件为“收费员”,其余查询条件输入合法值,查询一条指定数据"
        url= en.url.replace("202108120900001", self.data[12]).\
            replace("carTypeId=53", "carTypeId={}".format(self.data[0])).\
            replace("categoryId=14436", "categoryId={}".format(self.data[1])).\
            replace("dep=58", "dep={}".format(self.data[2])).\
            replace("regionId=72", "regionId={}".format(self.data[3])).\
            replace("status=4", "status={}".format(self.data[4])).\
            replace("type=1", "type={}".format(self.data[5])).\
            replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
            replace("companyId=9", "").\
            replace("attr=number", "attr=pay")
        re=heb.get(url=url,headers=en.header)
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'number':'{}'".format(self.data[9]) in str(re.json()).replace(" ",""))

    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_details_05(self):
        "收费单标记-查询:查询条件为“客户姓名”,其余查询条件输入合法值,查询一条指定数据"
        url= en.url.replace("202108120900001", self.data[13]).\
            replace("carTypeId=53", "carTypeId={}".format(self.data[0])).\
            replace("categoryId=14436", "categoryId={}".format(self.data[1])).\
            replace("dep=58", "dep={}".format(self.data[2])).\
            replace("regionId=72", "regionId={}".format(self.data[3])).\
            replace("status=4", "status={}".format(self.data[4])).\
            replace("type=1", "type={}".format(self.data[5])).\
            replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
            replace("companyId=9", "").\
            replace("attr=number", "attr=cname")
        re=heb.get(url=url,headers=en.header)
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'number':'{}'".format(self.data[9]) in str(re.json()).replace(" ",""))

    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_details_06(self):
        "收费单标记-查询:查询条件为“卡号”,其余查询条件输入合法值,查询一条指定数据"
        url= en.url.replace("202108120900001", self.data[15]).\
            replace("carTypeId=53", "carTypeId={}".format(self.data[0])).\
            replace("categoryId=14436", "categoryId={}".format(self.data[1])).\
            replace("dep=58", "dep={}".format(self.data[2])).\
            replace("regionId=72", "regionId={}".format(self.data[3])).\
            replace("status=4", "status={}".format(self.data[4])).\
            replace("type=1", "type={}".format(self.data[5])).\
            replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
            replace("companyId=9", "").\
            replace("attr=number", "attr=ic")
        re=heb.get(url=url,headers=en.header)
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'number':'{}'".format(self.data[9]) in str(re.json()).replace(" ",""))

    @unittest.case_mark(my.mark())
    def test_entranceFeeBill_details_07(self):
        "收费单标记-查询:查询条件为“手机号”,其余查询条件输入合法值,查询一条指定数据"
        url= en.url.replace("202108120900001", self.data[14]).\
            replace("carTypeId=53", "carTypeId={}".format(self.data[0])).\
            replace("categoryId=14436", "categoryId={}".format(self.data[1])).\
            replace("dep=58", "dep={}".format(self.data[2])).\
            replace("regionId=72", "regionId={}".format(self.data[3])).\
            replace("status=4", "status={}".format(self.data[4])).\
            replace("type=1", "type={}".format(self.data[5])).\
            replace("backSkinStatus=-1", "backSkinStatus={}".format(self.data[6])).\
            replace("companyId=9", "").\
            replace("attr=number", "attr=phone")
        re=heb.get(url=url,headers=en.header)
        print(re.json())
        self.assertEqual(re.status_code, 200)
        self.assertTrue("'number':'{}'".format(self.data[9]) in str(re.json()).replace(" ",""))


if __name__ == "__main__":

    unittest.main(verbosity=2)
    # com.run_one(test_entranceFeeBill_details("test_entranceFeeBill_details_01"))