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 test_unusual_parameter(self, unusual_parameter): log.info('准备开始执行:^^^^^ %s ^^^^^ 编号的测试用例' % unusual_parameter['编号']) 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_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_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')