mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
unittest export_journal
This commit is contained in:
parent
ac0233a162
commit
694ba3bad6
1 changed files with 23 additions and 0 deletions
23
tests/test_display.py
Normal file
23
tests/test_display.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import argparse
|
||||
import jrnl
|
||||
import pytest
|
||||
import mock
|
||||
from jrnl.jrnl import _export_journal, _display_search_results
|
||||
@pytest.mark.parametrize(
|
||||
"export_format",
|
||||
[
|
||||
"pretty",
|
||||
"short",
|
||||
"markdown",
|
||||
"json"
|
||||
]
|
||||
)
|
||||
@mock.patch.object(argparse,'Namespace',autospec=True)
|
||||
@mock.patch.object(jrnl,'Journal',autospec=True)
|
||||
def test_export_format(mock_journal, mock_args, export_format):
|
||||
mock_args.export = export_format
|
||||
mock_args.filename = "foo.jrnl"
|
||||
with mock.patch('builtins.print', wraps=print) as print_spy:
|
||||
_export_journal(mock_args,mock_journal)
|
||||
print_spy.assert_called_once()
|
||||
|
Loading…
Add table
Reference in a new issue