Merge branch 'develop' into encryption-rework

This commit is contained in:
Jonathan Wren 2022-10-08 16:00:19 -07:00
commit a9f57a0ce9
9 changed files with 49 additions and 19 deletions

View file

@ -118,7 +118,7 @@ def output_should_be_columns_wide(cli_run, width):
)
)
def default_journal_location(journal_file, journal_dir, config_on_disk, temp_dir):
default_journal_path = config_on_disk["journals"]["default"]
default_journal_path = config_on_disk["journals"]["default"]["journal"]
expected_journal_path = (
os.path.join(temp_dir.name, journal_file)
if journal_dir == "."

View file

@ -1,10 +1,16 @@
# Copyright © 2012-2022 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from unittest import mock
import pytest
from jrnl.exception import JrnlException
from jrnl.messages import Message
from jrnl.messages import MsgStyle
from jrnl.messages import MsgText
from jrnl.plugins.fancy_exporter import check_provided_linewrap_viability
from jrnl.plugins.yaml_exporter import YAMLExporter
@pytest.fixture()
@ -28,3 +34,15 @@ class TestFancy:
with pytest.raises(JrnlException):
check_provided_linewrap_viability(total_linewrap, [content], journal)
class TestYaml:
@mock.patch("jrnl.plugins.yaml_exporter.YAMLExporter.export_journal")
@mock.patch("builtins.open")
def test_export_to_nonexisting_folder(self, mock_open, mock_export_journal):
mock_export_journal.side_effect = JrnlException(
Message(MsgText.YamlMustBeDirectory, MsgStyle.ERROR)
)
with pytest.raises(JrnlException):
YAMLExporter.write_file("journal", "non-existing-path")
mock_open.assert_not_called()