From 2ac1139d61a3728cef94f2e95b5937b5b3116abb Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Wed, 26 Feb 2020 18:32:31 +0100 Subject: [PATCH] Improve revolut tests --- tests/test_revolut_processor.py | 35 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/tests/test_revolut_processor.py b/tests/test_revolut_processor.py index 810c5c2..8688354 100644 --- a/tests/test_revolut_processor.py +++ b/tests/test_revolut_processor.py @@ -8,61 +8,66 @@ from ofx_processor.processors.revolut import ( class RevolutProcessorTestCase(unittest.TestCase): - def test_process_amount_with_one_decimal_place(self): + def test_convert_amount_with_one_decimal_place(self): amount = "3,4" expected = 3.4 self.assertEqual(_amount_str_to_float(amount), expected) - def test_process_amount_with_two_decimal_places(self): + def test_convert_amount_with_two_decimal_places(self): amount = "3,41" expected = 3.41 self.assertEqual(_amount_str_to_float(amount), expected) - def test_process_amount_with_empty_string(self): + def test_convert_amount_with_empty_string(self): amount = "" expected = "" self.assertEqual(_amount_str_to_float(amount), expected) - def test_process_memo_with_category_and_rate(self): + def test_get_memo_with_category_and_rate(self): line = {"Category": "category name", "Exchange Rate": "exchange rate"} expected = "category name - exchange rate" self.assertEqual(RevolutLine(line).get_memo(), expected) - def test_process_memo_with_only_category(self): + def test_get_memo_with_only_category(self): line = {"Category": "category name", "Exchange Rate": ""} expected = "category name" self.assertEqual(RevolutLine(line).get_memo(), expected) - def test_process_memo_with_only_rate(self): + def test_get_memo_with_only_rate(self): line = {"Category": "", "Exchange Rate": "exchange rate"} expected = "exchange rate" self.assertEqual(RevolutLine(line).get_memo(), expected) - def test_process_memo_with_missing_keys(self): + def test_get_memo_with_missing_keys(self): line = {"Category": "category name"} expected = "category name" self.assertEqual(RevolutLine(line).get_memo(), expected) - def test_process_date(self): + def test_get_date(self): line = {"Completed Date": "January 16"} current_year = datetime.date.today().year expected = f"{current_year}-01-16" self.assertEqual(RevolutLine(line).get_date(), expected) - def test_process_date_other_year(self): + def test_get_date_other_year(self): line = {"Completed Date": "January 16 2019"} expected = f"2019-01-16" self.assertEqual(RevolutLine(line).get_date(), expected) - def test_process_inflow(self): + def test_get_amount_inflow(self): line = {"Paid In (EUR)": "3,42"} - expected = 3.42 - self.assertEqual(RevolutLine(line)._process_inflow(), expected) + expected = 3420 + self.assertEqual(RevolutLine(line).get_amount(), expected) - def test_process_outflow(self): + def test_get_amount_outflow(self): line = {"Paid Out (EUR)": "8,42"} - expected = 8.42 - self.assertEqual(RevolutLine(line)._process_outflow(), expected) + expected = -8420 + self.assertEqual(RevolutLine(line).get_amount(), expected) + + def test_get_payee(self): + line = {"Reference": "Hello world"} + expected = line["Reference"] + self.assertEqual(RevolutLine(line).get_payee(), expected) if __name__ == "__main__":