Example #1
0
class dealerCodeCheck(unittest.TestCase):
    maxDiff = None
    def setUp(self):
        self.s = login()
        self.baseurl = "http://bhtest.51s.co/vc/system/dealer"
        self.dealerid = None

    successData = loadTestData("dealer_code_success.xlsx")
    @parameterized.expand(successData)
    def test_code_success(self, _, data, expect):
        datas = json.dumps(json.loads(data)).encode('utf-8')
        expects = eval(expect)
        r = self.s.post(self.baseurl, datas)
        result = r.json()
        self.dealerid = result['data']['id']
        result['data']['id'] = '1'
        result['data']['dealerAgentAreaList'][0]['dealerId'] = '1'
        result['data']['createdTime'] = 1509798757095
        self.assertEqual(result, expects)

    failData = loadTestData("dealer_code_fail.xlsx")
    @parameterized.expand(failData)
    def test_code_fail(self, _, data, expect):
        datas = json.dumps(json.loads(data)).encode('utf-8')
        expects = eval(expect)
        r = self.s.post(self.baseurl, datas)
        result = r.json()
        self.dealerid = ''
        self.assertEqual(result, expects)

    def tearDown(self):
        deleteDealer(self.dealerid)
        if self.s:
            self.s.close()
Example #2
0
class dealerCompanyCheck(unittest.TestCase):
    maxDiff = None

    def setUp(self):
        self.s = login()
        self.baseurl = "http://bhtest.51s.co/vc/system/dealer"
        self.dealerid = None

    testData = loadTestData("dealer_company.xlsx")

    @parameterized.expand(testData)
    def test_company_check_normal(self, _, data, expect):
        datas = json.dumps(json.loads(data)).encode('utf-8')
        expects = eval(expect)
        r = self.s.post(self.baseurl, datas)
        result = r.json()
        self.dealerid = result['data']['id']
        result['data']['id'] = '1'
        result['data']['dealerAgentAreaList'][0]['dealerId'] = '1'
        result['data']['createdTime'] = 1509798757095
        self.assertEqual(result, expects)

    def tearDown(self):
        deleteDealer(self.dealerid)
        if self.s:
            self.s.close()

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