Increase test coverage

This commit is contained in:
Gabriel Augendre 2020-02-26 19:16:50 +01:00
parent a83aaf5201
commit 97f6f9ce93
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4
2 changed files with 38 additions and 4 deletions

View file

@ -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()

34
tests/test_utils.py Normal file
View file

@ -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