def test_checking_custom_payee(self): with open(os.path.join('fixtures', 'checking.ofx'), 'rb') as ofx_file: ofx = OfxParser.parse(ofx_file) converter = OfxConverter(account=ofx.account, name="Foo", payee_format="{memo}") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[0]), 'DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%' ) converter = OfxConverter(account=ofx.account, name="Foo", payee_format="{payee}") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[0]), 'DIVIDEND EARNED FOR PERIOD OF 03') converter = OfxConverter(account=ofx.account, name="Foo", payee_format="{account}") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[0]), 'Foo') converter = OfxConverter(account=ofx.account, name="Foo", payee_format=" {account} ") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[0]), 'Foo')
def test_checking_custom_payee(self): ofx = OfxParser.parse(open(os.path.join('fixtures', 'checking.ofx'))) converter = OfxConverter( account=ofx.account, name="Foo", payee_format="{memo}") self.assertEqual( converter.format_payee( ofx.account.statement.transactions[0]), 'DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%') converter = OfxConverter( account=ofx.account, name="Foo", payee_format="{payee}") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[0]), 'DIVIDEND EARNED FOR PERIOD OF 03') converter = OfxConverter( account=ofx.account, name="Foo", payee_format="{account}") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[0]), 'Foo') converter = OfxConverter( account=ofx.account, name="Foo", payee_format=" {account} ") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[0]), 'Foo')
def test_investments_custom_payee(self): ofx = OfxParser.parse(file(os.path.join('fixtures', 'investment_401k.ofx'))) converter = OfxConverter(ofx=ofx, name="Foo", payee_format="{txntype}") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[1]), 'transfer') converter = OfxConverter(ofx=ofx, name="Foo", payee_format="{tferaction}") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[1]), 'in')
def test_investments_custom_payee(ofx): converter = OfxConverter(account=ofx.account, name="Foo", payee_format="{txntype}") assert converter.format_payee( ofx.account.statement.transactions[1]) == "transfer" converter = OfxConverter(account=ofx.account, name="Foo", payee_format="{tferaction}") assert converter.format_payee( ofx.account.statement.transactions[1]) == "in"
def test_accented_characters_latin1(self): ofxpath = os.path.join('fixtures', 'accented_characters_latin1.ofx') ofx = OfxSynchronizer.parse_file(ofxpath) sync = OfxSynchronizer(self.lgr) txns = sync.filter(ofx.account.statement.transactions, ofx.account.account_id) converter = OfxConverter(account=ofx.account, name="Foo") self.assertEqual(converter.format_payee(txns[0]), "Virement Interac à: Jean") self.assertEqual(len(txns), 1)
def test_investments_custom_payee(self): ofx = OfxParser.parse( open( os.path.join( 'fixtures', 'investment_401k.ofx'))) converter = OfxConverter( account=ofx.account, name="Foo", payee_format="{txntype}") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[1]), 'transfer') converter = OfxConverter( account=ofx.account, name="Foo", payee_format="{tferaction}") self.assertEqual( converter.format_payee(ofx.account.statement.transactions[1]), 'in')
def test_checking_custom_payee(ofx): converter = OfxConverter(account=ofx.account, name="Foo", payee_format="{memo}") assert ( converter.format_payee(ofx.account.statement.transactions[0]) == "DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%" ) converter = OfxConverter(account=ofx.account, name="Foo", payee_format="{payee}") assert (converter.format_payee(ofx.account.statement.transactions[0]) == "DIVIDEND EARNED FOR PERIOD OF 03") converter = OfxConverter(account=ofx.account, name="Foo", payee_format="{account}") assert converter.format_payee( ofx.account.statement.transactions[0]) == "Foo" converter = OfxConverter(account=ofx.account, name="Foo", payee_format=" {account} ") assert converter.format_payee( ofx.account.statement.transactions[0]) == "Foo"
def test_accented_characters_latin1(ofx, ofx_sync): txns = ofx_sync.filter(ofx.account.statement.transactions, ofx.account.account_id) converter = OfxConverter(account=ofx.account, name="Foo") assert converter.format_payee(txns[0]) == "Virement Interac à: Jean" assert len(txns) == 1