fix failing test

This commit is contained in:
Jonathan Wren 2024-10-01 19:13:33 -07:00
parent 008c49bc96
commit 4b9bb5cb46
No known key found for this signature in database

View file

@ -6,9 +6,6 @@ from unittest import mock
import pytest import pytest
from jrnl.exception import JrnlException 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.fancy_exporter import check_provided_linewrap_viability
from jrnl.plugins.yaml_exporter import YAMLExporter from jrnl.plugins.yaml_exporter import YAMLExporter
@ -36,12 +33,8 @@ class TestFancy:
class TestYaml: class TestYaml:
@mock.patch("jrnl.plugins.yaml_exporter.YAMLExporter.export_journal")
@mock.patch("builtins.open") @mock.patch("builtins.open")
def test_export_to_nonexisting_folder(self, mock_open, mock_export_journal): def test_export_to_nonexisting_folder(self, mock_open):
mock_export_journal.side_effect = JrnlException(
Message(MsgText.YamlMustBeDirectory, MsgStyle.ERROR)
)
with pytest.raises(JrnlException): with pytest.raises(JrnlException):
YAMLExporter.write_file("journal", "non-existing-path") YAMLExporter.write_file("journal", "non-existing-path")
mock_open.assert_not_called() mock_open.assert_not_called()