mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 13:08:31 +02:00
update tests ith better verifications
This commit is contained in:
parent
b8b56124ee
commit
983c9c8c4b
2 changed files with 4 additions and 5 deletions
|
@ -28,7 +28,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@skip_win
|
@skip_win
|
||||||
@wip
|
|
||||||
Scenario: Override color selections with runtime overrides
|
Scenario: Override color selections with runtime overrides
|
||||||
Given we use the config "tiny.yaml"
|
Given we use the config "tiny.yaml"
|
||||||
When we run jrnl with -1 --config-override colors.body:blue
|
When we run jrnl with -1 --config-override colors.body:blue
|
||||||
|
|
|
@ -61,7 +61,7 @@ def config_override(context, key_as_dots: str, override_value: str):
|
||||||
:
|
:
|
||||||
run(context.parser)
|
run(context.parser)
|
||||||
runtime_cfg = mock_recurse.call_args_list[0][0][0]
|
runtime_cfg = mock_recurse.call_args_list[0][0][0]
|
||||||
assert mock_recurse.call_count == key_as_vec.__len__()
|
|
||||||
for k in key_as_vec:
|
for k in key_as_vec:
|
||||||
runtime_cfg = runtime_cfg['%s'%k]
|
runtime_cfg = runtime_cfg['%s'%k]
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ def editor_override(context, editor):
|
||||||
|
|
||||||
def _mock_write_in_editor(config):
|
def _mock_write_in_editor(config):
|
||||||
editor = config['editor']
|
editor = config['editor']
|
||||||
journal = '/tmp/journal.jrnl'
|
journal = 'features/journals/journal.jrnl'
|
||||||
context.tmpfile = journal
|
context.tmpfile = journal
|
||||||
print("%s has been launched"%editor)
|
print("%s has been launched"%editor)
|
||||||
return journal
|
return journal
|
||||||
|
@ -97,7 +97,7 @@ def editor_override(context, editor):
|
||||||
context.editor = mock_write_in_editor
|
context.editor = mock_write_in_editor
|
||||||
expected_config = context.cfg
|
expected_config = context.cfg
|
||||||
expected_config['editor'] = '%s'%editor
|
expected_config['editor'] = '%s'%editor
|
||||||
expected_config['journal'] ='/tmp/journal.jrnl'
|
expected_config['journal'] ='features/journals/journal.jrnl'
|
||||||
|
|
||||||
assert mock_write_in_editor.call_count == 1
|
assert mock_write_in_editor.call_count == 1
|
||||||
assert mock_write_in_editor.call_args[0][0]['editor']==editor
|
assert mock_write_in_editor.call_args[0][0]['editor']==editor
|
||||||
|
@ -112,7 +112,7 @@ def override_editor_to_use_stdin(context):
|
||||||
with \
|
with \
|
||||||
mock.patch('sys.stdin.read', return_value='Zwei peanuts walk into a bar und one of zem was a-salted')as mock_stdin_read, \
|
mock.patch('sys.stdin.read', return_value='Zwei peanuts walk into a bar und one of zem was a-salted')as mock_stdin_read, \
|
||||||
mock.patch("jrnl.install.load_or_install_jrnl", return_value=context.cfg), \
|
mock.patch("jrnl.install.load_or_install_jrnl", return_value=context.cfg), \
|
||||||
mock.patch("jrnl.Journal.open_journal", spec=False, return_value='/tmp/journal.jrnl'):
|
mock.patch("jrnl.Journal.open_journal", spec=False, return_value='features/journals/journal.jrnl'):
|
||||||
run(context.parser)
|
run(context.parser)
|
||||||
context.exit_status = 0
|
context.exit_status = 0
|
||||||
mock_stdin_read.assert_called_once()
|
mock_stdin_read.assert_called_once()
|
||||||
|
|
Loading…
Add table
Reference in a new issue