示例#1
0
 def test_flow_18(self, flow_9_9):
     """超时时数据回滚流程测试"""
     PreconditionWithdrawal.mct_update_amount_pre(flow_9_9)  # 补充测试商户的余额与可结算余额
     # 创造一个提现数据
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_9_9)
     befor_dic = MachAntWithdrawUp(self.after_treatment_data).amt_expected_results(is_borrow_money=False,
                                                                                   is_service_charge=False,
                                                                                   type=False)
     befor_dic['info_index']['with_draw_info_index'] = 1
     befor_dic['info_index']['mch_accnt_info_index'] = 2
     befor_dic['info_index']['his_settled_amount_index'] = 2
     try:
         res, html = RequestBase.send_request(**self.after_treatment_data)  # 发送请求
         PreconditionWithdrawal.update_pay_url(pay_type='time_out')
         PreconditionWithdrawal.mch_update_request_num('5')
         PreconditionWithdrawal.send_deal_withdraw()  # 触发提现定时器
         log.info('本次请求结果为%s' % html)
         aft_dic = MachAntWithdrawUp(self.after_treatment_data).amt_expected_results(is_borrow_money=False,
                                                                                     is_service_charge=False,
                                                                                     type=False)
         excepted = json.loads(self.after_treatment_data['excepted_code'])
         Handle.machaccnt_withdraw_assert(self, html, excepted, befor_dic, aft_dic)
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
示例#2
0
 def test_flow_1(self, flow_1):
     """缓存中不存在提现记录,在数据库中存在一条orderid为test1的数据,重新请求,金额相同,状态为3。 """
     PreconditionWithdrawal.mct_update_amount_pre(flow_1)  # 补充测试商户的余额与可结算余额
     # 创造一个提现数据
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_1)
     RequestBase.send_request(**self.after_treatment_data)
     PreconditionWithdrawal.mch_update_request_num('6')  # 将request_num置为6
     PreconditionWithdrawal.update_pay_url(pay_type='time_out')
     PreconditionWithdrawal.send_deal_withdraw()  # 触发提现定时器
     ClearingWithdrawal.redis_clear(self.after_treatment_data)  # 清理缓存记录
     # 构造预期结果
     kwargs = MachRefundPass.creat_except_data(with_draw_info_index=1, mch_accnt_info_index=3,
                                               his_settled_amount_index=3)
     try:
         self.flow_pass_public(data=flow_1, is_borrow_money=False, is_service_charge=False, type_befor=True,
                               type_after=False, **kwargs)
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
 def flow_pass_public(self, data, pay_type, *args, **kwargs):
     """流程公用 pay_type 为 模拟返回结果"""
     log.info('准备开始执行:^^^^^ %s ^^^^^ 编号的测试用例' % data['编号'])
     befor_tuple = MachAntWithdrawUp(
         self.after_treatment_data).timer_expected_results(True, *args)
     res, html = RequestBase.send_request(**
                                          self.after_treatment_data)  # 发送请求
     if kwargs.get('update_withdraw') is not None:
         PreconditionWithdrawal.mch_update_withdraw_status(
             kwargs['update_withdraw'])
     if kwargs.get('request_num') is not None:
         PreconditionWithdrawal.mch_update_request_num(
             kwargs['request_num'])
     PreconditionWithdrawal.update_pay_url(pay_type=pay_type)
     PreconditionWithdrawal.send_deal_withdraw()  # 触发提现定时器
     time.sleep(2)
     log.info('本次请求结果为%s' % html)
     after_tuple = MachAntWithdrawUp(
         self.after_treatment_data).timer_expected_results(False, *args)
     excepted = json.loads(self.after_treatment_data['excepted_code'])
     Handle.machaccnt_timer_assert(self, html, excepted, befor_tuple,
                                   after_tuple)