test_upStream.py 1.52 KB
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import unittest
import urllib3
from commons.MySession import my
from commons.api.upStream import upStream
from commons import common as com
from commons import common
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
uu=upStream()


class test_upStream(unittest.TestCase):
    "上游企业列表查询接口"

    @unittest.case_mark(my.mark())
    def test_upStream_01(self):
        "成功查询上下游企业,无过滤条件"
        #请求数据不需要修改,直接POST请求
        re=my.post(url=uu.url,headers=uu.header,json=uu.body)
        print(re.json())
        #响应断言
        self.assertEqual(re.status_code, 200)
        self.assertTrue("total" in re.json().keys())
        self.assertTrue("上游" in str(re.json()).replace(" ",""))


    @unittest.skipDepend(depend="test_upStream_01")
    @unittest.case_mark(my.mark(1))
    def test_upStream_02(self):
        "成功查询上下游企业,加入企业/个人名称过滤条件"
        #请求数据需要修改
        body=uu.body.copy()
        body["likeName"]="111"
        #POST请求
        re=my.post(url=uu.url,headers=uu.header,json=body)
        print(re.json())
        #响应断言
        self.assertEqual(re.status_code, 200)
        self.assertTrue("legalPerson':'哈哈哈'" in str(re.json()).replace(" ",""))
           
    @classmethod
    def tearDownClass(cls):
        pass

if __name__ == "__main__":
    unittest.main(verbosity=2)

#     com.run_one(test_upStream("test_01_upStream"))