Exemplo n.º 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地址
Exemplo n.º 2
0
 def test_flow_15(self, flow_9_6):
     """缓存中不存在提现记录,在数据库中存在一条orderid为test1的数据,重新请求,金额相同。 withdraw_status2。提现完成订单返回 分为status为失败"""
     PreconditionWithdrawal.mct_update_amount_pre(flow_9_6)  # 补充测试商户的余额与可结算余额
     # 创造一个提现数据
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_9_6)
     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
     RequestBase.send_request(**self.after_treatment_data)
     PreconditionWithdrawal.update_pay_url(pay_type='fail')
     PreconditionWithdrawal.send_deal_withdraw()  # 触发提现定时器
     ClearingWithdrawal.redis_clear(self.after_treatment_data)  # 清理缓存记录
     try:
         res, html = RequestBase.send_request(**self.after_treatment_data)  # 发送请求
         self.assertNotEqual(len(html.get('biz_content').get('errmsg')), '交易失败',
                             msg='没有返回数据库以存在的T0020181229204406000002交易失败的信息')
         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地址
Exemplo n.º 3
0
 def test_flow_16(self, flow_9_7):
     """缓存中不存在提现记录,在数据库中存在一条orderid为test1的数据,
     有提现手续费,无准备金借取,重新请求,金额相同。 withdraw_status2。提现完成订单返回 分为status为失败"""
     PreconditionWithdrawal.mct_update_amount_pre(flow_9_7)
     # 创造一个提现数据
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_9_7)
     PreconditionWithdrawal.mch_update_fixed_poundage(button=Constants.RESULT.TRUE)  # 开启提现手续费
     befor_dic = MachAntWithdrawUp(self.after_treatment_data).amt_expected_results(is_borrow_money=False,
                                                                                   is_service_charge=True,
                                                                                   type=False)
     befor_dic['info_index']['with_draw_info_index'] = 1
     befor_dic['info_index']['mch_accnt_info_index'] = 4  # 提现扣减 手续费扣减 提现退还 手续费退还
     befor_dic['info_index']['his_settled_amount_index'] = 6  # 三条正向操作提现记录 三条退还提现记录
     befor_dic['info_index']['profit_index'] = 2  # 提现增加手续费 退还减少手续费
     RequestBase.send_request(**self.after_treatment_data)
     PreconditionWithdrawal.update_pay_url(pay_type='fail')
     PreconditionWithdrawal.send_deal_withdraw()  # 触发提现定时器
     ClearingWithdrawal.redis_clear(self.after_treatment_data)  # 清理缓存记录
     try:
         res, html = RequestBase.send_request(**self.after_treatment_data)  # 发送请求
         self.assertNotEqual(len(html.get('biz_content').get('errmsg')), '交易失败',
                             msg='没有返回数据库以存在的T0020181229204406000002交易失败的信息')
         log.info('本次请求结果为%s' % html)
         aft_dic = MachAntWithdrawUp(self.after_treatment_data).amt_expected_results(is_borrow_money=False,
                                                                                     is_service_charge=True,
                                                                                     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.mch_update_fixed_poundage(button=Constants.RESULT.FALSE)  # 关闭提现手续费
         PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.mch_update_fixed_poundage(button=Constants.RESULT.FALSE)  # 关闭提现手续费
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
 def test_unusual_parameter(self, unusual_parameter):
     """异常参数校验方法"""
     log.info('准备开始执行:^^^^^ %s ^^^^^ 编号的测试用例' % unusual_parameter['编号'])
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(unusual_parameter)
     log.info('参数化处理后的测试数据为:--%s' % self.after_treatment_data)
     res, html = RequestBase.send_request(**self.after_treatment_data)  # 发送请求
     log.info('==============================本次请求结果为:::%s' % html)
     excepted = json.loads(self.after_treatment_data['excepted_code'])
     Handle.machaccnt_withdraw_assert(self, html, excepted, part=True)
Exemplo n.º 5
0
 def flow_pass_public(self, data, is_borrow_money, is_service_charge, type_befor, type_after, **kwargs):
     """流程公用"""
     log.info('准备开始执行:^^^^^ %s ^^^^^ 编号的测试用例' % data['编号'])
     befor_dic = MachAntWithdrawUp(self.after_treatment_data).amt_expected_results(is_borrow_money,
                                                                                   is_service_charge, type_befor,
                                                                                   **kwargs)
     res, html = RequestBase.send_request(**self.after_treatment_data)  # 发送请求
     log.info('本次请求结果为%s' % html)
     aft_dic = MachAntWithdrawUp(self.after_treatment_data).amt_expected_results(is_borrow_money, is_service_charge,
                                                                                 type_after, **kwargs)
     excepted = json.loads(self.after_treatment_data['excepted_code'])
     Handle.machaccnt_withdraw_assert(self, html, excepted, befor_dic, aft_dic)