jrnl/tests/unit/test_config_file.py
Jonathan Wren f5e052937c
Update copyright year (#1502)
Update copyright year in comment headers and --version output
2022-06-18 11:30:56 -07:00

26 lines
832 B
Python

# Copyright (C) 2012-2022 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import pytest
import os
from jrnl.install import find_alt_config
from jrnl.exception import JrnlException
def test_find_alt_config(request):
work_config_path = os.path.join(
request.fspath.dirname, "..", "data", "configs", "basic_onefile.yaml"
)
found_alt_config = find_alt_config(work_config_path)
assert found_alt_config == work_config_path
def test_find_alt_config_not_exist(request):
bad_config_path = os.path.join(
request.fspath.dirname, "..", "data", "configs", "does-not-exist.yaml"
)
with pytest.raises(JrnlException) as ex:
found_alt_config = find_alt_config(bad_config_path)
assert found_alt_config is not None
assert isinstance(ex.value, JrnlException)