def test_all_new_txns(self): ledger = Ledger(os.path.join('fixtures', 'empty.lgr')) acct = Mock() acct.download = Mock( return_value=file(os.path.join('fixtures', 'checking.ofx'))) sync = OfxSynchronizer(ledger) self.assertEqual(len(sync.get_new_txns(acct, 7, 7)[1]), 3)
def sync(ledger, accounts, args): sync = OfxSynchronizer(ledger, shortenaccount=args.shortenaccount) for acct in accounts: try: (ofx, txns) = sync.get_new_txns(acct, resync=args.resync, max_days=args.max) if ofx is not None: converter = make_ofx_converter( account=ofx.account, name=acct.description, ledger=ledger, indent=args.indent, fid=None, unknownaccount=args.unknownaccount, payee_format=args.payee_format, hardcodeaccount=None, shortenaccount=args.shortenaccount, security_list=SecurityList(ofx), date_format=args.date_format, infer_account=args.infer_account) print_results(converter, ofx, ledger, txns, args) except KeyboardInterrupt: raise except BaseException: sys.stderr.write("Caught exception processing %s\n" % (acct.description)) traceback.print_exc(file=sys.stderr)
def test_sync_no_ledger(self): acct = Mock() acct.download = Mock( return_value=open( os.path.join( 'fixtures', 'checking.ofx'))) sync = OfxSynchronizer(None) self.assertEqual(len(sync.get_new_txns(acct, 7, 7)[1]), 3)
def test_all_new_txns(self): ledger = Ledger(os.path.join('fixtures', 'empty.lgr')) acct = Mock() acct.download = Mock( return_value=open( os.path.join( 'fixtures', 'checking.ofx'))) sync = OfxSynchronizer(ledger) self.assertEqual(len(sync.get_new_txns(acct, 7, 7)[1]), 3)
def sync(ledger, accounts, args): sync = OfxSynchronizer(ledger) for acct in accounts: try: (ofx, txns) = sync.get_new_txns(acct, resync=args.resync, max_days=args.max) if ofx is not None: converter = OfxConverter(account=ofx.account, name=acct.description, ledger=ledger, indent=args.indent, unknownaccount=args.unknownaccount) print_results(converter, ofx, ledger, txns, args) except KeyboardInterrupt: raise except: sys.stderr.write("Caught exception processing %s" % (acct.description)) traceback.print_exc(file=sys.stderr)
def sync(ledger, accounts, args): sync = OfxSynchronizer(ledger, shortenaccount=args.shortenaccount) for acct in accounts: try: (ofx, txns) = sync.get_new_txns(acct, resync=args.resync, max_days=args.max) if ofx is not None: converter = make_ofx_converter(account=ofx.account, name=acct.description, ledger=ledger, indent=args.indent, fid=None, unknownaccount=args.unknownaccount, payee_format=args.payee_format, hardcodeaccount=None, shortenaccount=args.shortenaccount, security_list=SecurityList(ofx)) print_results(converter, ofx, ledger, txns, args) except KeyboardInterrupt: raise except BaseException: sys.stderr.write("Caught exception processing %s\n" % (acct.description)) traceback.print_exc(file=sys.stderr)
def test_sync_no_ledger(self): acct = Mock() acct.download = Mock( return_value=file(os.path.join('fixtures', 'checking.ofx'))) sync = OfxSynchronizer(None) self.assertEqual(len(sync.get_new_txns(acct, 7, 7)[1]), 3)