From 97f6f9ce93b35e24c9037c7e4bcae2aef04f01fa Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Wed, 26 Feb 2020 19:16:50 +0100 Subject: [PATCH] Increase test coverage --- ofx_processor/utils/processor.py | 8 ++++---- tests/test_utils.py | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 tests/test_utils.py diff --git a/ofx_processor/utils/processor.py b/ofx_processor/utils/processor.py index ea65969..dd0caf7 100644 --- a/ofx_processor/utils/processor.py +++ b/ofx_processor/utils/processor.py @@ -12,16 +12,16 @@ class Line: self.data = data def get_date(self): - pass + raise NotImplementedError # pragma: nocover def get_amount(self): - pass + raise NotImplementedError # pragma: nocover def get_memo(self): - pass + raise NotImplementedError # pragma: nocover def get_payee(self): - pass + raise NotImplementedError # pragma: nocover def to_ynab_transaction(self, transaction_ids): date = self.get_date() diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 0000000..ceb9a37 --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,34 @@ +import unittest +from unittest import mock +from unittest.mock import call + +from click.testing import CliRunner + +from ofx_processor.processors.bpvf import BpvfProcessor +from ofx_processor.processors.ce import CeProcessor +from ofx_processor.processors.revolut import RevolutProcessor +from ofx_processor.utils.ynab import config + + +class UtilsTestCase(unittest.TestCase): + @staticmethod + def test_discover_processors(): + ce_main = CeProcessor.main + bpvf_main = BpvfProcessor.main + revolut_main = RevolutProcessor.main + runner = CliRunner() + with mock.patch("click.core.Group.add_command") as add_command: + from ofx_processor.main import cli + + runner.invoke(cli, ["--help"]) + calls = [ + call(ce_main), + call(bpvf_main), + call(revolut_main), + call(config, name="config"), + ] + add_command.assert_has_calls(calls, any_order=True) + + +if __name__ == "__main__": + unittest.main() # pragma: nocover