コード例 #1
0
 def test_yl_reconciliation_false(self):
     """yl对不平测试用例"""
     CreatReconciliation().yl_in_transit_data()  # 制造记账退款在途数据
     zfb_path = Constants.RECONCILIATION.false_yl_path  # 获取对账单数据
     path_name = FtpConnect().push_file_csv_on_ftp(zfb_path)
     PreconditionDowStatement.creat_download_info(Constants.CHANNEL.yl,
                                                  path_name, '20200519',
                                                  'yl')
     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)
コード例 #2
0
 def test_analyze_statement_info_data_true(self):
     """FTP服务器上有对账单,数据库dowloadinfo表中该条记录为1时,解析对账单(正常流程,测试解析完成后是否能重复解析)"""
     zfb_path = Constants.STATEMENT.zfb_path
     self.path_name = FtpConnect().push_file_csv_on_ftp(zfb_path)
     yesterday = str(datetime.date.today() -
                     datetime.timedelta(days=1)).replace('-', '')
     PreconditionDowStatement.creat_download_info(Constants.CHANNEL.zfb,
                                                  self.path_name, yesterday,
                                                  'zfb')
     PreconditionDowStatement.update_into_data()
     PreconditionDowStatement.statement_analyze_send(yesterday)
     after_len = PreconditionDowStatement.select_count_mch_details()
     after_into_data = PreconditionDowStatement.select_into_data()
     self.assertEqual(0,
                      after_len,
                      msg='对账单解析数据错误,CSV文件条目数为%s db查询出来的条目数为%s' %
                      (0, after_len))
     self.assertEqual('1',
                      after_into_data,
                      msg='对账单解析标志改变出现错误,预期应该为1,实际为%s' % after_into_data)
コード例 #3
0
 def test_analyze_statement_flow_pass(self, zfb_path):
     """FTP服务器上有对账单,数据库dowloadinfo表中该条记录为0时,解析对账单(正常流程,测试解析数据时是否正确入库)"""
     log.info('开始执行解析%s对账单测试' % (zfb_path[1]))
     self.path_name = FtpConnect().push_file_csv_on_ftp(zfb_path[0])
     yesterday = str(datetime.date.today() -
                     datetime.timedelta(days=1)).replace('-', '')
     PreconditionDowStatement.creat_download_info(zfb_path[2],
                                                  self.path_name, yesterday,
                                                  zfb_path[1])
     PreconditionDowStatement.statement_analyze_send(yesterday)
     befor_len = PreconditionDowStatement.get_csv_len(zfb_path[0])
     after_len = PreconditionDowStatement.select_count_mch_details()
     after_into_data = PreconditionDowStatement.select_into_data()
     self.assertEqual(befor_len,
                      after_len,
                      msg='%s对账单解析数据错误,CSV文件条目数为%s db查询出来的条目数为%s' %
                      (zfb_path[1], befor_len, after_len))
     self.assertEqual('1',
                      after_into_data,
                      msg='对账单解析标志改变出现错误,预期应该为1,实际为%s' % after_into_data)
コード例 #4
0
 def test_analyze_statement(self):
     """FTP服务器上无对账单,数据库存在记录时,解析对账单(ftp误删)支付宝"""
     zfb_path = Constants.STATEMENT.none_zfb_path
     self.path_name = FtpConnect().push_file_csv_on_ftp(zfb_path)
     yesterday = str(datetime.date.today() -
                     datetime.timedelta(days=1)).replace('-', '')
     PreconditionDowStatement.creat_download_info(Constants.CHANNEL.zfb,
                                                  self.path_name, yesterday,
                                                  'zfb')
     PreconditionDowStatement.statement_analyze_send(yesterday)
     befor_len = PreconditionDowStatement.get_csv_len(zfb_path)
     after_len = PreconditionDowStatement.select_count_mch_details()
     after_into_data = PreconditionDowStatement.select_into_data()
     self.assertEqual(befor_len,
                      after_len,
                      msg='对账单解析数据错误,CSV文件条目数为%s db查询出来的条目数为%s' %
                      (befor_len, after_len))
     self.assertEqual(None,
                      after_into_data,
                      msg='对账单解析标志改变出现错误,预期应该为1,实际为%s' % after_into_data)
コード例 #5
0
 def tearDown(self):
     FtpConnect().delete_file(self.path_name)
     ClearDownloadStatement.clear_down_load_info()
     ClearDownloadStatement.clear_mch_account_details()
     pass
コード例 #6
0
 def get_file_list_size(file_list):
     file_size_list = list()
     for file_name in file_list:
         size = FtpConnect().get_file_size(file_name)
         file_size_list.append(size)
     return file_size_list
コード例 #7
0
 def get_file_number_for_ftp():
     """获取ftp的数量"""
     file_list, file_number = FtpConnect().get_dir_list()
     return file_list, file_number