Clean up controller

- streamline `run` function in `controller.py`
- add debug logging
- fix unnecessary import of Journal class (only needed for typing)
- standardize summary display across different actions
This commit is contained in:
Jonathan Wren 2023-02-11 13:52:53 -08:00
parent bade98ef0d
commit c182395fce
2 changed files with 47 additions and 40 deletions

View file

@ -18,15 +18,13 @@ def random_string():
@pytest.mark.parametrize("export_format", ["pretty", "short"])
@mock.patch("builtins.print")
@mock.patch("jrnl.controller.Journal.pprint")
def test_display_search_results_pretty_short(mock_pprint, mock_print, export_format):
def test_display_search_results_pretty_short(export_format):
mock_args = parse_args(["--format", export_format])
test_journal = mock.Mock(wraps=jrnl.journals.Journal)
test_journal = mock.Mock(wraps=jrnl.journals.Journal('default'))
_display_search_results(mock_args, test_journal)
mock_print.assert_called_once_with(mock_pprint.return_value)
test_journal.pprint.assert_called_once()
@pytest.mark.parametrize(