mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-04 23:46:14 +02:00
test that no editor is launched
This commit is contained in:
parent
93c62215d9
commit
11f4a87b05
2 changed files with 9 additions and 4 deletions
|
@ -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"
|
When we run "jrnl --decrypt --config-override highlight false --config-override editor nano"
|
||||||
Then the runtime config should have "encrypt" set to "false"
|
Then the runtime config should have "encrypt" set to "false"
|
||||||
And the runtime config should have "highlight" 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
|
@skip_win
|
||||||
Scenario: Override configured linewrap with a value of 23
|
Scenario: Override configured linewrap with a value of 23
|
||||||
|
|
|
@ -49,7 +49,8 @@ def config_override(context, key_as_dots: str, override_value: str):
|
||||||
|
|
||||||
|
|
||||||
@then("the editor {editor} should have been called")
|
@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):
|
def _mock_write_in_editor(config):
|
||||||
editor = config["editor"]
|
editor = config["editor"]
|
||||||
journal = "features/journals/journal.jrnl"
|
journal = "features/journals/journal.jrnl"
|
||||||
|
@ -80,8 +81,12 @@ def editor_override(context, editor):
|
||||||
expected_config['editor'] = '%s'%editor
|
expected_config['editor'] = '%s'%editor
|
||||||
expected_config['journal'] ='features/journals/journal.jrnl'
|
expected_config['journal'] ='features/journals/journal.jrnl'
|
||||||
|
|
||||||
assert mock_write_in_editor.call_count == 1
|
if editor is not None:
|
||||||
assert mock_write_in_editor.call_args[0][0]['editor']==editor
|
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:
|
except SystemExit as e:
|
||||||
context.exit_status = e.code
|
context.exit_status = e.code
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue