test that no editor is launched

This commit is contained in:
sriniv27 2021-02-09 19:46:48 -05:00
parent 93c62215d9
commit 11f4a87b05
2 changed files with 9 additions and 4 deletions

View file

@ -12,7 +12,7 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
When we run "jrnl --decrypt --config-override highlight false --config-override editor nano"
Then the runtime config should have "encrypt" set to "false"
And the runtime config should have "highlight" set to "false"
And the editor "N/A" should have been called
And no editor should have been called
@skip_win
Scenario: Override configured linewrap with a value of 23

View file

@ -49,7 +49,8 @@ def config_override(context, key_as_dots: str, override_value: str):
@then("the editor {editor} should have been called")
def editor_override(context, editor):
@then("No editor should have been called")
def editor_override(context, editor=None):
def _mock_write_in_editor(config):
editor = config["editor"]
journal = "features/journals/journal.jrnl"
@ -80,8 +81,12 @@ def editor_override(context, editor):
expected_config['editor'] = '%s'%editor
expected_config['journal'] ='features/journals/journal.jrnl'
assert mock_write_in_editor.call_count == 1
assert mock_write_in_editor.call_args[0][0]['editor']==editor
if editor is not None:
assert mock_write_in_editor.call_count == 1
assert mock_write_in_editor.call_args[0][0]['editor']==editor
else:
# Expect that editor is *never* called
mock_write_in_editor.assert_not_called()
except SystemExit as e:
context.exit_status = e.code
# fmt: on