mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
add jrnl interface test for overriden configurations
This commit is contained in:
parent
ee7cd44a32
commit
53d7d8cea4
1 changed files with 25 additions and 0 deletions
25
tests/test_config.py
Normal file
25
tests/test_config.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import pytest
|
||||||
|
import pytest_mock
|
||||||
|
import mock
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
from jrnl.args import parse_args
|
||||||
|
from jrnl.jrnl import run
|
||||||
|
from jrnl import install
|
||||||
|
|
||||||
|
@pytest.fixture()
|
||||||
|
def minimal_config():
|
||||||
|
with open('features/data/configs/editor.yaml','r') as cfg_file:
|
||||||
|
yield yaml.load(cfg_file.read())
|
||||||
|
|
||||||
|
from jrnl import jrnl
|
||||||
|
@mock.patch.object(jrnl,'write_mode')
|
||||||
|
@mock.patch.object(install,'load_or_install_jrnl')
|
||||||
|
def test_override_configured_editor(mock_load_or_install, mock_write_mode, minimal_config):
|
||||||
|
mock_load_or_install.return_value = minimal_config
|
||||||
|
cli_args = ['--override','{\"editor\": \"nano\"}' ]
|
||||||
|
parser = parse_args(cli_args)
|
||||||
|
assert parser.config_override.__len__() == 1
|
||||||
|
with mock.patch('subprocess.call'):
|
||||||
|
res = run(parser)
|
||||||
|
assert res==None
|
Loading…
Add table
Reference in a new issue