示例#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_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地址
示例#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_flow_not_change_pay(self, flow_not_change_pay):
     log.info('准备开始执行:^^^^^ %s ^^^^^ 编号的测试用例' % flow_not_change_pay['编号'])
     # 数据初次处理,将数据data中的变量进行替换
     self.after_treatment_data = Handle.machaccnt_pay_dispatch_handle(
         flow_not_change_pay)
     log.info('参数化处理后的测试数据为:--%s' % self.after_treatment_data)
     # model模块中的事前调用预处理,主要是返回出数据库查询所使用的条件,和数据库层面的预期结果构造,对象MachPayDispatchUp
     self.mach_pay_up_obj = MachPayDispatchUp(self.after_treatment_data)
     log.info('预处理返回的内容 mach_pay_up_obj:: %s' % self.mach_pay_up_obj)
     # 通过precondition事前处理器拿到数据库在请求前所需要记录的数据,为了验证请求后的数据变化,去不同的子表中查询出 金额 事前 事后等数据 该子商户现有金额
     amt_info_bef, mch_ant_bef = PreconditionKeepingAccounts.mct_pay_dispatch_pre(
         self.mach_pay_up_obj)
     res, html = RequestBase.send_request(**
                                          self.after_treatment_data)  # 发送请求
     log.info('本次请求结果为%s' % html)
     # 请求后查询数据变化
     excepted = json.loads(self.after_treatment_data['excepted_code'])
     self.amt_info_after, mch_ant_after = PreconditionKeepingAccounts.mct_pay_dispatch_pre(
         self.mach_pay_up_obj)
     log.info('本次数据库查询实际结果返回为 amt_info_after:%s \n mch_ant_after:%s' %
              (self.amt_info_after, mch_ant_after))
     # 进行结果校验对比,对比内容为excl中的验证点
     Handle.machaccnt_pay_dispatch_assert(self, html, excepted,
                                          self.mach_pay_up_obj, mch_ant_bef,
                                          mch_ant_after,
                                          self.amt_info_after)
     log.info(
         '********************************测试结束 -- 数据清理完成 --********************************************'
     )
 def err_public(self, data):
     log.info('准备开始执行:^^^^^ %s ^^^^^ 编号的测试用例' % data['编号'])
     self.after_treatment_data = Handle.machaccnt_pay_dispatch_handle(data)
     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_promotion_refund_dispatch_assert(self, html, excepted, part=Constants.RESULT.TRUE)
 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)
示例#7
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)
示例#8
0
 def test_unusual_parameter2(self, unusual_parameter):
     # 提前准备一条数据
     PreconditionKeepingAccounts.mct_promotion_refund_pre(
         Constants.PRE_DATA.PAY_DATA)
     self.after_treatment_data = Handle.machaccnt_pay_dispatch_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_pay_dispatch_assert(self, html, excepted, part=True)
 def test_flow_3(self, flow_3):
     """
     缓存中存在一条提现记录,在未过期的情况下发起提现
     """
     PreconditionWithdrawal.mct_update_amount_pre(flow_3)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_3)
     RequestBase.send_request(**self.after_treatment_data)
     self.err_public(flow_3)
 def test_zfb_reconciliation_true(self):
     """支付宝对平测试用例集合"""
     CreatReconciliation().zfb_in_transit_true_data()  # 制造对平的在途数据
     zfb_path = Constants.RECONCILIATION.true_zfb_path  # 获取对账单数据
     path_name = FtpConnect().push_file_csv_on_ftp(zfb_path)
     PreconditionDowStatement.creat_download_info(Constants.CHANNEL.zfb,
                                                  path_name, '20200519',
                                                  'zfb')
     PreconditionDowStatement.statement_analyze_send()
     PreconditionDowStatement.recondition()
     expect = CreatReconciliation.info_assert_kwargs(trans_fee='87',
                                                     recon_amt=27413,
                                                     account_type='Y',
                                                     info_len=0,
                                                     info_list=[])
     actual = PreconditionReconciliation.info_assert_kwargs_actual()
     Handle.machaccnt_handle_assert(self, expect, actual)
示例#11
0
 def test_flow_6(self, flow_6):
     """商户类型为子商户,无提现手续费,提现金额小于商户可结算余额流程测试"""
     PreconditionWithdrawal.mct_update_amount_pre(flow_6)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_6)
     # 构造预期结果
     kwargs = MachRefundPass.creat_except_data(with_draw_info_index=1, mch_accnt_info_index=1,
                                               his_settled_amount_index=1)
     self.flow_pass_public(data=flow_6, is_borrow_money=False, is_service_charge=False, type_befor=True,
                           type_after=False, **kwargs)
 def test_dlb_reconciliation_false(self):
     """dlb对不平测试用例"""
     CreatReconciliation().dlb_in_transit_data()  # 制造记账退款在途数据
     zfb_path = Constants.RECONCILIATION.false_dlb_path  # 获取对账单数据
     path_name = FtpConnect().push_file_csv_on_ftp(zfb_path)
     PreconditionDowStatement.creat_download_info(Constants.CHANNEL.dlb,
                                                  path_name, '20200519',
                                                  'dlb')
     PreconditionDowStatement.statement_analyze_send()
     PreconditionDowStatement.recondition()
     expect = CreatReconciliation.info_assert_kwargs(
         trans_fee='280',
         recon_amt=85820,
         account_type='N',
         info_len=10,
         info_list=['2', '0', '0', '2', '1', '1', '1', '1', '1', '1'])
     actual = PreconditionReconciliation.info_assert_kwargs_actual()
     Handle.machaccnt_handle_assert(self, expect, actual)
 def test_flow_5(self, flow_5):
     """
     缓存存在,但数据库不存在,发起提现请求
     """
     PreconditionWithdrawal.mct_update_amount_pre(flow_5)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_5)
     RequestBase.send_request(**self.after_treatment_data)
     # 清理数据库记录
     ClearingWithdrawal.withdrawal_clear(self.after_treatment_data)
     self.err_public(flow_5)
 def test_flow_6(self, flow_6):
     """
     缓存中不存在提现记录,在数据库中存在一条orderid为test1的数据,重新请求,金额相同。
     """
     PreconditionWithdrawal.mct_update_amount_pre(flow_6)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_6)
     RequestBase.send_request(**self.after_treatment_data)
     # 清理缓存记录
     ClearingWithdrawal.redis_clear(self.after_treatment_data)
     self.err_public(flow_6)
 def test_flow_2(self, flow_2):
     """创造一条withdraw_status=0,status=3的测试数据,调用定时器,模拟提现接口返回为失败 预期status=1,withdraw_status=2提现失败"""
     PreconditionWithdrawal.mct_update_amount_pre(flow_2)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_2)
     try:
         self.flow_pass_public(flow_2, 'fail', *('2', '2', '交易失败', 0))
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(
             pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
 def test_flow_4(self, flow_4):
     """创造一条withdraw_status=0,status=3的测试数据,调用定时器,模拟提现接口返回为超时 预期withdraw_status=0,status=3 num=1 """
     PreconditionWithdrawal.mct_update_amount_pre(flow_4)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_4)
     try:
         self.flow_pass_public(flow_4, 'time_out', *('0', '3', None, 1))
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(
             pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
 def test_flow_3(self, flow_3):
     """创造一条withdraw_status=0,status=3的测试数据,调用定时器,模拟提现接口返回为未决 预期status=1,withdraw_status=2"""
     PreconditionWithdrawal.mct_update_amount_pre(flow_3)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_3)
     try:
         self.flow_pass_public(flow_3, 'wait', *('1', '3', '未决', 0))
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(
             pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
示例#18
0
 def test_flow_2(self, flow_2):
     """商户类型为分润商户的无手续费正常提现测试"""
     PreconditionWithdrawal.mct_update_amount_pre(flow_2)  # 补充测试商户的余额与可结算余额
     # 创造一个提现数据
     PreconditionWithdrawal.mch_update_fixed_poundage(button=Constants.RESULT.FALSE)  # 清空提现手续费
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_2)
     # 构造预期结果
     kwargs = MachRefundPass.creat_except_data(with_draw_info_index=1, profit_index=1,
                                               his_settled_amount_index=1)
     self.flow_pass_public(data=flow_2, is_borrow_money=False, is_service_charge=False, type_befor=True,
                           type_after=False, **kwargs)
 def test_flow_4(self, flow_4):
     """
     缓存中不存在提现记录,在数据库中存在一条orderid为test1的数据,重新请求,金额不同。
     """
     PreconditionWithdrawal.mct_update_amount_pre(flow_4)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_4)
     self.after_treatment_data['data']['biz_content']['amount'] = '5000'
     RequestBase.send_request(**self.after_treatment_data)
     # 清理缓存的记录
     ClearingWithdrawal.redis_clear(self.after_treatment_data)
     self.after_treatment_data['data']['biz_content']['amount'] = '4000'
     self.err_public(flow_4)
 def test_flow_8(self, flow_8):
     """创造一条withdraw_status为4,status=3的测试数据,调用定时器,模拟查询接口暂时未处理"""
     PreconditionWithdrawal.mct_update_amount_pre(flow_8)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_8)
     try:
         self.flow_pass_public(flow_8, 'select_wait', *('4', '3', None, 0),
                               **{'update_withdraw': '4'})
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(
             pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
示例#21
0
 def test_unusual_parameter3(self, unusual_parameter):
     # 提前准备一条数据
     PreconditionKeepingAccounts.mct_promotion_refund_pre(
         Constants.PRE_DATA.PAY_DATA)
     self.after_treatment_data = Handle.machaccnt_pay_dispatch_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'])
     try:
         Handle.machaccnt_pay_dispatch_assert(self,
                                              html,
                                              excepted,
                                              part=True)
     except Exception as e:
         ClearingKeepingAccounts.err_data_clear(
             self.after_treatment_data, trans_no='MH20181229115220NBUu')
         raise e
     ClearingKeepingAccounts.err_data_clear(self.after_treatment_data,
                                            trans_no='MH20181229115220NBUu')
 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)
 def test_flow_9_6(self, flow_17):
     """创造一条withdraw_status为0,status=3,number=5 的测试数据,调用定时器,模拟提现接口超时 预期withdraw_status为3  status=2  number=0"""
     PreconditionWithdrawal.mct_update_amount_pre(
         flow_17)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_17)
     try:
         self.flow_pass_public(flow_17, 'time_out', *('0', '3', None, 3),
                               **{'request_num': '2'})
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(
             pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
 def test_flow_9_3(self, flow_12):
     """创造一条withdraw_status为1,status=3的测试数据,调用定时器,模拟查询接口返回不存在 预期withdraw_status更新为0"""
     PreconditionWithdrawal.mct_update_amount_pre(
         flow_12)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_12)
     try:
         self.flow_pass_public(flow_12, 'select_none', *('0', '3', None, 0),
                               **{'update_withdraw': '1'})
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(
             pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
 def test_flow_5(self, flow_5):
     """创造一条withdraw_status为4,status=3的测试数据,调用定时器,模拟查询接口返回成功,预期status=1,withdraw_status=2提现成功"""
     PreconditionWithdrawal.mct_update_amount_pre(flow_5)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_5)
     try:
         self.flow_pass_public(flow_5, 'select_success',
                               *('2', '1', '交易成功', 0),
                               **{'update_withdraw': '4'})
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(
             pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
 def test_flow_9_6(self, flow_15):
     """创造一条withdraw_status为1,status=3的测试数据,调用定时器,模拟查询接口失败"""
     PreconditionWithdrawal.mct_update_amount_pre(
         flow_15)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_15)
     try:
         self.flow_pass_public(flow_15, 'select_fail',
                               *('2', '2', '查询结果为提现失败', 0),
                               **{'update_withdraw': '4'})
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(
             pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
 def test_flow_9_1(self, flow_10):
     """创造一条withdraw_status为0,status=3的测试数据,调用定时器,模拟提现接口失败,过长的remark测试是否能正常储存"""
     PreconditionWithdrawal.mct_update_amount_pre(
         flow_10)  # 补充测试商户的余额与可结算余额
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_10)
     try:
         self.flow_pass_public(
             flow_10, 'select_long',
             *('2', '2',
               '交易失败交易失败交易失败交易失败交易失败交易失败交易失败交易失败交易失败交易失败交易失败交易失败交易', 0))
     except Exception as e:
         PreconditionWithdrawal.update_pay_url(
             pay_type='default')  # 回复默认url地址
         raise e
     PreconditionWithdrawal.update_pay_url(pay_type='default')  # 回复默认url地址
示例#28
0
 def test_flow_4(self, flow_4):
     """
     商户类型为子商户,银行卡姓名相同,提现方式为超级网银金额小于100万进行提现测试(启用定时器)
     商户类型为子商户,银行卡姓名相同,提现方式为普通网银进行测试(启用定时器)
     """
     PreconditionWithdrawal.mct_update_amount_pre(flow_4)  # 补充测试商户的余额与可结算余额
     # 创造一个提现数据
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_4)
     # 构造预期结果
     kwargs = MachRefundPass.creat_except_data(with_draw_info_index=1, mch_accnt_info_index=1,
                                               his_settled_amount_index=1)
     self.flow_pass_public(data=flow_4, is_borrow_money=False, is_service_charge=False, type_befor=True,
                           type_after=False, **kwargs)
     PreconditionWithdrawal.send_deal_withdraw()  # 触发提现定时器 检查提现是否有返回
     result = PreconditionWithdrawal.with_draw_info()
     self.assertEqual(result, '交易成功')
示例#29
0
 def test_flow_11(self, flow_9_2):
     """
     商户类型为子商户,无提现手续费,需要借用准备金流程测试
     """
     PreconditionWithdrawal.mct_update_amount_pre(flow_9_2, set_amt='1000')
     self.after_treatment_data = Handle.machaccnt_withdraw_handle(flow_9_2)
     PreconditionWithdrawal.mct_update_super_money_pre(is_change=Constants.RESULT.TRUE)  # 开启超额提现
     kwargs = MachRefundPass.creat_except_data(with_draw_info_index=1, mch_accnt_info_index=1,
                                               his_settled_amount_index=1, propay_index=1)
     try:
         self.flow_pass_public(data=flow_9_2, is_borrow_money=True, is_service_charge=True, type_befor=True,
                               type_after=False, **kwargs)
     except Exception as e:
         PreconditionWithdrawal.mct_update_super_money_pre(is_change=Constants.RESULT.FALSE)  # 关闭超额提现
         raise e
     PreconditionWithdrawal.mct_update_super_money_pre(is_change=Constants.RESULT.FALSE)  # 关闭超额提现
示例#30
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地址