add test to repro issue #955

This commit is contained in:
Jonathan Wren 2020-07-02 00:14:03 -07:00
parent f86d923843
commit 6f7c538cb1
3 changed files with 13 additions and 1 deletions

View file

@ -4,6 +4,7 @@ editor: ''
template: false
encrypt: false
highlight: true
editor: noop
journals:
default: features/journals/dayone.dayone
linewrap: 80

View file

@ -75,3 +75,9 @@ Feature: Dayone specific implementation details.
and the json output should contain entries.0.creator.generation_date
and the json output should contain entries.0.creator.device_agent
and "entries.0.creator.software_agent" in the json output should contain "jrnl"
Scenario: Editing Dayone with mock editor
Given we use the config "dayone.yaml"
When we run "jrnl --edit"
Then we should get no error

View file

@ -209,8 +209,13 @@ def run(context, command, cache_dir=None):
args = ushlex(command)
def _mock_editor(command):
context.editor_command = command
try:
with patch("sys.argv", args):
with patch("sys.argv", args), patch(
"subprocess.call", side_effect=_mock_editor
):
cli.run(args[1:])
context.exit_status = 0
except SystemExit as e: