def test_101_sign_credit(self, r, env, red):
     """上传授信协议"""
     data = excel_table_byname(self.file, 'contract_sign')
     param = json.loads(data[0]['param'])
     param.update({
         "serviceSn":
         Common.get_random('serviceSn'),
         "sourceUserId":
         r.get(red["source_user_id"]),
         "contractType":
         5,
         "sourceContractId":
         Common.get_random('userid'),
         "transactionId":
         r.get(red["transaction_id"]),
         "associationId":
         r.get(red["project_id"]),
         "content":
         Common.get_json_data('data', 'credit_sign.json').get("content")
     })
     if len(data[0]['headers']) == 0:
         headers = None
     else:
         headers = json.loads(data[0]['headers'])
     rep = Common.response(faceaddr=data[0]['url'],
                           headers=headers,
                           data=json.dumps(param, ensure_ascii=False),
                           product="cloudloan",
                           environment=env)
     assert rep['resultCode'] == int(data[0]['resultCode'])
Exemplo n.º 2
0
 def test_115_debt_transfer(self):
     """上传债转函"""
     data = excel_table_byname(self.file, 'contract_sign')
     param = Common.get_json_data('data', 'kkd_debt_transfer.json')
     param.update({
         "serviceSn":
         Common.get_random('serviceSn'),
         "sourceUserId":
         self.r.get('jfqjy_6_periods_sourceUserId'),
         "sourceContractId":
         Common.get_random('userid'),
         "transactionId":
         self.r.get('jfqjy_6_periods_transactionId'),
         "associationId":
         self.r.get('jfqjy_6_periods_projectId')
     })
     if len(data[0]['headers']) == 0:
         headers = None
     else:
         headers = json.loads(data[0]['headers'])
     rep = Common.response(faceaddr=data[0]['url'],
                           headers=headers,
                           data=json.dumps(param, ensure_ascii=False),
                           product="cloudloan",
                           environment=self.env)
     self.r.set("jfqjy_6_periods_contractId", rep['content']['contractId'])
     self.assertEqual(rep['resultCode'], int(data[0]['resultCode']))
Exemplo n.º 3
0
 def test_112_deduction_share_sign(self):
     """委托划扣协议上传"""
     data = excel_table_byname(self.file, 'upload')
     param = Common.get_json_data('data', 'rong_pay_upload.json')
     param.update({
         "associationId":
         self.r.get("jk_ckshd_12_periods_signId"),
         "requestId":
         Common.get_random("serviceSn"),
         "sourceContractId":
         Common.get_random("serviceSn"),
         "sourceUserId":
         self.r.get("jk_ckshd_12_periods_sourceUserId")
     })
     if len(data[0]['headers']) == 0:
         headers = None
     else:
         headers = json.loads(data[0]['headers'])
     headers["X-TBC-SKIP-SIGN"] = 'true'
     headers["X-TBC-SKIP-ENCRYPT"] = 'true'
     rep = Common.response(faceaddr=data[0]['url'],
                           headers=headers,
                           data=json.dumps(param, ensure_ascii=False),
                           product="gateway",
                           environment=self.env,
                           prod_type="wxjk")
     self.assertEqual(rep['code'], int(data[0]['resultCode']))
 def test_107_confirm(self, r, env, red):
     """确认签约"""
     data = excel_table_byname(self.file, 'confirm')
     param = Common.get_json_data("data", "rmkj_confirm.json")
     param.update({
         "requestId": Common.get_random("serviceSn"),
         "requestTime": Common.get_time("-"),
         "sourceUserId": r.get(red["source_user_id"]),
         "signTaskId": r.get(red["sign_id"]),
         "smsCode": "849201"
     })
     if len(data[0]['headers']) == 0:
         headers = None
     else:
         headers = json.loads(data[0]['headers'])
     headers["X-TBC-SKIP-SIGN"] = 'true'
     headers["X-TBC-SKIP-ENCRYPT"] = 'true'
     rep = Common.response(faceaddr=data[0]['url'],
                           headers=headers,
                           data=json.dumps(param, ensure_ascii=False),
                           product='gateway',
                           environment=env,
                           prod_type="rmkj")
     assert rep['code'] == int(data[0]['resultCode'])
     assert rep['data']['code'] in (60103, 3)
Exemplo n.º 5
0
	def test_107_contract_sign(self):
		"""上传借款合同"""
		data = excel_table_byname(self.file, 'contract_sign')
		param = json.loads(data[0]['param'])
		param.update(
			{
				"serviceSn": Common.get_random('serviceSn'),
				"sourceUserId": self.r.get('jfx_sourceUserId'),
				"contractType": 2,
				"sourceContractId": Common.get_random('userid'),
				"transactionId": self.r.get('jfx_transactionId'),
				"associationId": self.r.get('jfx_projectId'),
				"content": Common.get_json_data('data', 'borrow_sign.json').get("content")
			}
		)
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = Common.response(
			faceaddr=data[0]['url'],
			headers=headers,
			data=json.dumps(param, ensure_ascii=False),
			product="cloudloan",
			environment=self.env
		)
		self.assertEqual(int(data[0]['resultCode']), rep['resultCode'])
Exemplo n.º 6
0
def send_report():
    """
	使用smtp发送测试报告
	"""
    with open(globals()['filename'], 'rb') as f:
        mail_body = f.read()
    msg = MIMEMultipart()
    msg['From'] = '*****@*****.**'
    msg['To'] = '*****@*****.**'
    mails = Common.get_json_data('config',
                                 'mail.json').get(sys.argv[1].split("_")[0])
    msg['Subject'] = Header(mails['Subject'][sys.argv[3]], 'utf8')
    msg['CC'] = mails['cc']

    msg_file = MIMEText(mail_body, 'base64', 'utf8')
    msg_file['Content-Type'] = 'application/octet-stream'
    msg_file["Content-Disposition"] = 'attachment;filename=report.html'
    msg.attach(msg_file)

    smtp = smtplib.SMTP('smtp.163.com')
    smtp.set_debuglevel(1)
    # smtp.login('*****@*****.**', 'nrkquovrupcbbeej')  # 登录邮箱
    smtp.login('*****@*****.**', '3416162zxc')  # 登录邮箱
    smtp.sendmail(msg['From'], (msg['To'].split(';') + msg['CC'].split(';')),
                  msg.as_string())
    # smtp.sendmail(msg['From'], (msg['To'].split(';')), msg.as_string())
    smtp.quit()
    logger.info('Report has send out!')
Exemplo n.º 7
0
class contract_sign(unittest.TestCase):
    excel = os.path.dirname(os.path.dirname(
        os.path.abspath(__file__))) + Config().Get_Item(
            'File', 'czb_case_file')
    excel_data = excel_table_byname(excel, 'contract_sign')

    def setUp(self):
        self.cm = Common()
        self.data = self.cm.get_json_data('chezhibao_contract_sign.json')
        self.env = sys.argv[3]

    def tearDown(self):
        pass

    @ddt.data(*excel_data)
    def test_contract_sign(self, data):
        print("接口名称:%s" % data['casename'])
        param = self.data
        if len(data['headers']) == 0:
            headers = None
        else:
            headers = json.loads(data['headers'])
        rep = self.cm.Response(faceaddr=data['url'],
                               headers=headers,
                               param=json.dumps(
                                   param, ensure_ascii=False).encode('utf-8'),
                               environment=self.env)
        print("响应结果:%s" % rep)
        print("返回信息:%s" % rep.text)
        logger.info("返回信息:%s" % rep.text)
        self.assertEqual(str(json.loads(rep.text)['resultCode']),
                         data['resultCode'])
Exemplo n.º 8
0
    def test_2_loanasset(self):
        """翼支付进件放款同步接口"""
        data = excel_table_byname(self.file, 'loan_asset')
        print("接口名称:%s" % data[0]['casename'])
        param = Common.get_json_data("data", "yzf_tp.json")
        if len(param['repaymentPlanList']) / 2 == 6:
            period = 3
        elif len(param['repaymentPlanList']) / 2 == 12:
            period = 6
        elif len(param['repaymentPlanList']) / 2 == 18:
            period = 9
        elif len(param['repaymentPlanList']) / 2 == 24:
            period = 12
        elif len(param['repaymentPlanList']) / 2 == 48:
            period = 24
        param['asset'].update({
            "projectId":
            self.r.get("yzf_repayment_normal_settle_projectId"),
            "sourceProjectId":
            self.r.get("yzf_repayment_normal_settle_sourceProjectId"),
            "transactionId":
            "Apollo" + Common.get_random("transactionId"),
            "repaymentDay":
            Common.get_time("day").split('-')[1],
            "firstRepaymentDate":
            Common.get_repaydate(period)[0],
            "lastRepaymentDate":
            Common.get_repaydate(period)[-1],
            "loanTime":
            Common.get_time("-")
        })
        for i in range(0, period * 4):
            param['repaymentPlanList'][i].update({
                "sourcePlanId":
                Common.get_random("sourceProjectId"),
                "planPayDate":
                Common.get_repaydate(period)[
                    param['repaymentPlanList'][i]['period'] - 1]
            })

        if len(data[0]['headers']) == 0:
            headers = None
        else:
            headers = json.loads(data[0]['headers'])
        rep = Common.response(faceaddr=data[0]['url'],
                              headers=headers,
                              data=json.dumps(param, ensure_ascii=False),
                              environment=self.env,
                              product="pintic")
        self.assertEqual(rep['resultCode'], int(data[0]['msgCode']))
Exemplo n.º 9
0
    def test_2_loanasset(self, r, env):
        """翼支付进件放款同步接口"""
        global period
        data = excel_table_byname(self.file, 'loan_asset')
        print("接口名称:%s" % data[0]['casename'])
        param = Common.get_json_data("data", "yzf_tp.json")
        param['asset'].update({
            "projectId":
            r.get("yzf_projectId"),
            "sourceProjectId":
            r.get("yzf_sourceProjectId"),
            "transactionId":
            "Apollo" + Common.get_random("transactionId"),
            "repaymentDay":
            Common.get_time("day").split('-')[1],
            "firstRepaymentDate":
            Common.get_repaydate(24)[0],
            "lastRepaymentDate":
            Common.get_repaydate(24)[-1],
            "loanTime":
            Common.get_time("-")
        })

        for i in range(96):
            period = param['repaymentPlanList'][i]['period']
            param['repaymentPlanList'][i].update({
                "sourcePlanId":
                Common.get_random("sourceProjectId"),
                "planPayDate":
                Common.get_repaydate(period=period)[period - 1]
            })
        for i in range(48):
            period = param['repaymentPlanList'][i]['period']
            param['feePlanList'][i].update({
                "sourcePlanId":
                Common.get_random("sourceProjectId"),
                "planPayDate":
                Common.get_repaydate(period=period)[period - 1]
            })

        if len(data[0]['headers']) == 0:
            headers = None
        else:
            headers = json.loads(data[0]['headers'])
        rep = Common.response(faceaddr=data[0]['url'],
                              headers=headers,
                              data=json.dumps(param, ensure_ascii=False),
                              environment=env,
                              product="pintic")
        assert rep['resultCode'] == int(data[0]['msgCode'])
 def test_115_debt_transfer(self, r, env, red):
     """上传债转函"""
     data = excel_table_byname(self.file, 'contract_sign')
     param = Common.get_json_data('data', 'kkd_debt_transfer.json')
     param.update({
         "serviceSn": Common.get_random('serviceSn'),
         "sourceUserId": r.get(red["source_user_id"]),
         "sourceContractId": Common.get_random('userid'),
         "transactionId": r.get(red["transaction_id"]),
         "associationId": r.get(red["project_id"])
     })
     if len(data[0]['headers']) == 0:
         headers = None
     else:
         headers = json.loads(data[0]['headers'])
     rep = Common.response(faceaddr=data[0]['url'],
                           headers=headers,
                           data=json.dumps(param, ensure_ascii=False),
                           product="cloudloan",
                           environment=env)
     assert rep['resultCode'] == int(data[0]['resultCode'])
     r.setex(red["contract_id"], 72000, rep['content']['contractId'])
Exemplo n.º 11
0
 def test_107_confirm(self):
     """确认签约"""
     data = excel_table_byname(self.file, 'confirm')
     param = Common.get_json_data("data", "rmkj_confirm.json")
     param.update({
         "requestId": Common.get_random("serviceSn"),
         "requestTime": Common.get_time("-"),
         "sourceUserId": self.r.get("rmkj_6_periods_sourceUserId"),
         "signTaskId": self.r.get("rmkj_6_periods_signTaskId"),
         "smsCode": "849201"
     })
     if len(data[0]['headers']) == 0:
         headers = None
     else:
         headers = json.loads(data[0]['headers'])
     rep = Common.response(faceaddr=data[0]['url'],
                           headers=headers,
                           data=json.dumps(param, ensure_ascii=False),
                           product='pay',
                           environment=self.env)
     self.assertEqual(rep['code'], int(data[0]['resultCode']))
     self.assertEqual(rep['data']['status'], 3)
Exemplo n.º 12
0
	def test_103_loanasset(self):
		"""橙分期进件放款同步接口"""
		global period
		data = excel_table_byname(self.file, 'loan_asset')
		param = Common.get_json_data("data", "cfq_24_periods_test_loan.json")
		param['asset'].update(
			{
				"projectId": self.r.get("cfq_24_periods_projectId"),
				"sourceProjectId": self.r.get("cfq_24_periods_sourceProjectId"),
				"transactionId": "Apollo" + Common.get_random("transactionId"),
				"repaymentDay": Common.get_time("day").split('-')[1],
				"firstRepaymentDate": Common.get_repaydate(24)[0],
				"lastRepaymentDate": Common.get_repaydate(24)[-1],
				"loanTime": Common.get_time("-")
			}
		)

		for i in range(0, 96):
			period = param['repaymentPlanList'][i]['period']
			param['repaymentPlanList'][i].update(
				{
					"sourcePlanId": Common.get_random("sourceProjectId"),
					"planPayDate": Common.get_repaydate(period=period)[period - 1]
				}
			)
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = Common.response(
			faceaddr=data[0]['url'],
			headers=headers,
			data=json.dumps(param, ensure_ascii=False),
			environment=self.env,
			product="pintec",
			prod_type="pintec"
		)
		self.assertEqual(rep['resultCode'], int(data[0]['msgCode']))
Exemplo n.º 13
0
 def test_103_sign_borrow(self, r, env):
     """上传借款协议"""
     data = excel_table_byname(self.file, 'contract_sign')
     param = Common.get_json_data('data', 'cfq_sign_borrow.json')
     param.update({
         "serviceSn": Common.get_random('serviceSn'),
         "sourceUserId": r.get('cfq_12_periods_sourceUserId'),
         "contractType": 2,
         "sourceContractId": Common.get_random('userid'),
         "transactionId": r.get('cfq_12_periods_transactionId'),
         "associationId": r.get('cfq_12_periods_projectId')
     })
     if len(data[0]['headers']) == 0:
         headers = None
     else:
         headers = json.loads(data[0]['headers'])
     rep = Common.response(faceaddr=data[0]['url'],
                           headers=headers,
                           data=json.dumps(param, ensure_ascii=False),
                           product="pintec",
                           environment=env)
     r.set("cfq_12_periods_contractId", rep['content']['contractId'])
     assert rep['resultCode'], int(data[0]['resultCode'])
Exemplo n.º 14
0
class credit_apply(unittest.TestCase):

	def setUp(self):
		self.cm = Common()
		self.r = self.cm.conn_redis()
		self.env = sys.argv[3]

	def tearDown(self):
		pass

	def test_0_credit_apply(self):
		'''额度授信'''
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'credit_apply_data')
		print("接口名称:%s" % data[0]['casename'])
		self.cm.p2p_get_userinfo('czb')
		self.r.mset(
			{"sourceUserId": self.cm.get_random('userid'),
			 "transactionId": self.cm.get_random('transactionId'),
			 "phone": self.cm.get_random('phone'),
			 "firstCreditDate": self.cm.get_time()
			 }
		)
		param = json.loads(data[0]['param'])
		param['personalInfo'].update({"cardNum": str(self.r.get('cardNum'), encoding='utf8')})
		param['personalInfo'].update({"custName": str(self.r.get('custName').decode())})
		param['personalInfo'].update({"phone": str(self.r.get('phone'), encoding='utf8')})
		param['applyInfo'].update({"applyTime": self.cm.get_time()})
		param['riskSuggestion'].update({"firstCreditDate": str(self.r.get('firstCreditDate'), encoding='utf8')})
		param.update({"sourceUserId": str(self.r.get('sourceUserId'), encoding='utf8')})
		param.update({"serviceSn": self.cm.get_random('serviceSn')})
		param.update({"transactionId": str(self.r.get('transactionId'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		creditId = json.loads(rep.text)['content']['creditId']
		userId = json.loads(rep.text)['content']['userId']
		self.r.mset({"creditId": creditId, "userId": userId})
		print("creditId:%s" % creditId)
		print("userId:%s" % userId)
		print("sourceUserId:%s" % self.r.get('sourceUserId'))
		print("transactionId:%s" % self.r.get('transactionId'))
		print("phone:%s" % self.r.get('phone'))
		print("cardNum:%s" % self.r.get('cardNum'))
		print("custName:%s" % str(self.r.get('custName'), encoding='utf8'))
		logger.info("phone:%s" % self.r.get('phone'))
		logger.info("cardNum:%s" % self.r.get('cardNum'))
		logger.info("custName:%s" % str(self.r.get('custName'), encoding='utf8'))
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_1_query_result(self):
		'''授信结果查询'''
		time.sleep(10)
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'credit_query_result')
		print("接口名称:%s" % data[0]['casename'])
		param = json.loads(data[0]['param'])
		param.update({"creditId": str(self.r.get('creditId'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_2_query_user_amount(self):
		'''用户额度查询'''
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'query_user_amount')
		print("接口名称:%s" % data[0]['casename'])
		param = json.loads(data[0]['param'])
		param.update({"sourceUserId": str(self.r.get('sourceUserId'), encoding='utf8')})
		param.update({"userId": str(self.r.get('userId'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_3_sign_credit(self):
		'''上传授信协议'''
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'contract_sign')
		print("接口名称:%s" % data[0]['casename'])
		param = self.cm.get_json_data('chezhibao_contract_sign.json')
		param.update({"serviceSn": self.cm.get_random('serviceSn')})
		param.update({"sourceUserId": str(self.r.get('sourceUserId'), encoding='utf8')})
		param.update({"contractType": 1})
		param.update({"sourceContractId": self.cm.get_random('userid')})
		param.update({"transactionId": str(self.r.get('transactionId'), encoding='utf8')})
		param.update({"associationId": str(self.r.get('creditId'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_4_project_apply(self):
		'''进件'''
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'test_project')
		print("接口名称:%s" % data[0]['casename'])
		param = json.loads(data[0]['param'])
		self.r.set('sourceProjectId', self.cm.get_random('sourceProjectId'))
		param.update({"sourceProjectId": str(self.r.get('sourceProjectId'), encoding='utf8')})
		param.update({"sourceUserId": str(self.r.get('sourceUserId'), encoding='utf8')})
		param.update({"transactionId": str(self.r.get('transactionId'), encoding='utf8')})
		param['personalInfo'].update({"cardNum": str(self.r.get('cardNum'), encoding='utf8')})
		param['personalInfo'].update({"custName": self.r.get('custName').decode()})
		param['personalInfo'].update({"phone": str(self.r.get('phone'), encoding='utf8')})
		param['applyInfo'].update({"applyTime": self.cm.get_time()})
		param['riskSuggestion'].update({"firstCreditDate": str(self.r.get('firstCreditDate'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		projectId = json.loads(rep.text)['content']['projectId']
		self.r.set('projectId', projectId)
		print("projectId:%s" % self.r.get('projectId'))
		print("sourceProjectId:%s" % self.r.get('sourceProjectId'))
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_5_query_apply_result(self):
		'''进件结果查询'''
		time.sleep(10)
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'project_query_apply_result')
		print("接口名称:%s" % data[0]['casename'])
		param = json.loads(data[0]['param'])
		param.update({"sourceProjectId": str(self.r.get('sourceProjectId'), encoding='utf8')})
		param.update({"projectId": str(self.r.get('projectId'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_6_contract_sign(self):
		'''上传借款合同'''
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'contract_sign')
		print("接口名称:%s" % data[0]['casename'])
		param = self.cm.get_json_data('chezhibao_contract_sign.json')
		param.update({"serviceSn": self.cm.get_random('serviceSn')})
		param.update({"sourceUserId": str(self.r.get('sourceUserId'), encoding='utf8')})
		param.update({"contractType": 2})
		param.update({"sourceContractId": self.cm.get_random('userid')})
		param.update({"transactionId": str(self.r.get('transactionId'), encoding='utf8')})
		param.update({"associationId": str(self.r.get('projectId'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_61_contract_sign(self):
		'''上传车辆交易单'''
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'contract_sign')
		print("接口名称:%s" % data[0]['casename'])
		param = self.cm.get_json_data('chezhibao_contract_sign.json')
		param.update({"serviceSn": self.cm.get_random('serviceSn')})
		param.update({"sourceUserId": str(self.r.get('sourceUserId'), encoding='utf8')})
		param.update({"contractType": 3})
		param.update({"sourceContractId": self.cm.get_random('userid')})
		param.update({"transactionId": str(self.r.get('transactionId'), encoding='utf8')})
		param.update({"associationId": str(self.r.get('projectId'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_62_contract_sign(self):
		'''上传车辆收购合同'''
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'contract_sign')
		print("接口名称:%s" % data[0]['casename'])
		param = self.cm.get_json_data('chezhibao_contract_sign.json')
		param.update({"serviceSn": self.cm.get_random('serviceSn')})
		param.update({"sourceUserId": str(self.r.get('sourceUserId'), encoding='utf8')})
		param.update({"contractType": 4})
		param.update({"sourceContractId": self.cm.get_random('userid')})
		param.update({"transactionId": str(self.r.get('transactionId'), encoding='utf8')})
		param.update({"associationId": str(self.r.get('projectId'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_7_pfa(self):
		'''放款'''
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'project_loan')
		param = json.loads(data[0]['param'])
		param.update({"sourceProjectId": str(self.r.get('sourceProjectId'), encoding='utf8')})
		param.update({"projectId": str(self.r.get('projectId'), encoding='utf8')})
		param.update({"sourceUserId": str(self.r.get('sourceUserId'), encoding='utf8')})
		param.update({"serviceSn": self.cm.get_random('serviceSn')})
		# param.update({"accountName": self.r.get('custName').decode()})
		# param.update({"id": str(self.r.get('cardNum'), encoding='utf8')})
		self.r.set("pfa_serviceSn", param['serviceSn'])
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_8_pfa_query(self):
		'''放款结果查询'''
		time.sleep(10)
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'pfa_query')
		param = json.loads(data[0]['param'])
		param.update({"serviceSn": str(self.r.get('pfa_serviceSn'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_9_query_repaymentplan(self):
		'''还款计划查询'''
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'repayment_plan')
		param = json.loads(data[0]['param'])
		param.update({"projectId": str(self.r.get('projectId'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	def test_A_pre_clear_calculate(self):
		'''提前结清试算'''
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'pre_clear_calculate')
		param = json.loads(data[0]['param'])
		param.update({"projectId": str(self.r.get('projectId'), encoding='utf8')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))

	@unittest.skip(reason="跳过还款用例")
	def test_B_repay(self):
		"""还款确认"""
		excel = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + Config().Get_Item('File', 'czb_case_file')
		data = excel_table_byname(excel, 'repay')
		param = json.loads(data[0]['param'])
		assetId = self.cm.get_sql_data('czb', 'dev1', project_id=str(self.r.get('projectId'), encoding='utf-8'),
									   factor='id', select='assert')
		param.update({"assetId": assetId})
		param.update({"clearTime": self.cm.get_time('-')})
		if len(data[0]['headers']) == 0:
			headers = None
		else:
			headers = json.loads(data[0]['headers'])
		rep = self.cm.Response(faceaddr=data[0]['url'], headers=headers,
							   param=json.dumps(param, ensure_ascii=False).encode('utf-8'), environment=self.env)
		print("返回信息:%s" % rep.text)
		logger.info("返回信息:%s" % rep.text)
		self.assertEqual(json.loads(rep.text)['resultCode'], int(data[0]['resultCode']))