Exemplo n.º 1
0
    def test_0002_a_precisefind(self):
        """
        根据被保险人查询单子
        :return:
        """
        Con = Config()
        test = Assertions()
        allure = Allure()
        reques = Request.Request(self.evn)
        data = Basic()

        urls = data.url
        parms = data.data
        headers = data.header

        json_header = {'Authorization': 'bearer%s' % Con.token_debug}

        host = Con.host_debug
        req_url = 'https://' + host

        test_data = Con.get_conf(Con.TITLE_DATA, Config.VALUE_insuredPerson)
        api_url = req_url + urls[0]['url_2'] + test_data
        response = reques.get_request(api_url, json_header)
        allure.allure_step('第一步', '查询单子',
                           '根据被保险人,精准查询单子数量:%s' % response['jsons']['total'])
        print('根据被保险人,精准查询单子数量:%s' % response['jsons']['total'])
        assert test.assert_text(response['jsons']['total'] > 1, True)
Exemplo n.º 2
0
    def test_0001_add(self):
        """创建新单"""
        Con = Config()
        test = Assertions()
        allure = Allure()
        reques = Request.Request(self.evn)
        data = Basic()

        urls = data.url
        parms = data.data
        headers = data.header

        Con.set_item(Con.TITLE_DATA, Con.VALUE_policyNo,
                     self.create_time() + '-' + self.create_unix())
        Con.set_item(Con.TITLE_DATA, Con.VALUE_reportNo,
                     self.create_time() + '-' + self.create_unix())
        Con.set_item(Con.TITLE_DATA, Con.VALUE_reporttime, self.create_time())

        policyNo = Con.get_conf(Con.TITLE_DATA, Config.VALUE_policyNo)
        reportNo = Con.get_conf(Con.TITLE_DATA, Config.VALUE_reportNo)

        json_data = {
            'reportDate': self.create_now_time(),
            "insuranceComName": Con.insuranceComName,
            "insuredPerson": Con.insuredPerson,
            "policyNo": policyNo,
            "reportNo": reportNo,
        }
        data_new = dict(parms[0], **json_data)

        json_header = {'Authorization': 'bearer %s' % reques.get_session}
        header_new = dict(headers[0], **json_header)

        host = Con.host_debug
        req_url = 'https://' + host

        api_url = req_url + urls[0]['url_1']
        response = reques.post_request(api_url, json.dumps(data_new),
                                       header_new)

        allure.allure_step('第一步', '添加单子', (response['stats']))
        assert test.assert_code(response['code'], 200)
        assert test.assert_text((response['stats'])['success'], True)

        #查询事故号:
        req_url_1 = 'https://' + host
        url_find = req_url_1 + urls[0][
            'url_2'] + '&policyNo=' + policyNo + '&reportDate='

        res = reques.get_request(url_find, json_header)
        Con.set_item(Con.TITLE_DATA, Con.VALUE_reporttid,
                     res['jsons']['rows'][0]['id'])
        allure.allure_step('第二步', '查询单子',
                           '事故号id为:%s' % res['jsons']['rows'][0]['id'])
        print('事故号id为:%s' % res['jsons']['rows'][0]['id'])