Add more tests

This commit is contained in:
Gabriel Augendre 2020-09-01 19:27:24 +02:00
parent e15c452367
commit bd5e7dddec
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4
2 changed files with 20 additions and 0 deletions

View file

@ -46,6 +46,16 @@ class LclLineTestCase(unittest.TestCase):
result_date = LclLine(transaction).get_date() result_date = LclLine(transaction).get_date()
self.assertEqual(result_date, expected_date) self.assertEqual(result_date, expected_date)
def test_get_date_with_transaction_name_wrong_date(self):
transaction = OfxTransaction(
dtposted=datetime.datetime(2020, 1, 23, 1, 2, 3),
name=" CB IKEA 25/25/25",
)
expected_date = "2020-01-23"
result_date = LclLine(transaction).get_date()
self.assertEqual(result_date, expected_date)
def test_get_amount_positive(self): def test_get_amount_positive(self):
transaction = OfxTransaction(trnamt=52.2) transaction = OfxTransaction(trnamt=52.2)
expected_amount = 52200 expected_amount = 52200

View file

@ -0,0 +1,10 @@
from ofx_processor.utils.base_ofx import OfxBaseLine
from tests.utils import OfxTransaction
def test_name():
name = "VIR INST"
transaction = OfxTransaction(name=name)
result_name = OfxBaseLine(transaction).get_payee()
assert result_name == name