mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
Add _mock_editor_function
This commit is contained in:
parent
ccb55392dd
commit
9b0ebb7d84
1 changed files with 9 additions and 1 deletions
|
@ -71,7 +71,15 @@ def set_config(context, config_file):
|
|||
@when('we open the editor and enter {text}')
|
||||
def open_editor_and_enter(context, text=""):
|
||||
text = (text or context.text)
|
||||
with patch('subprocess.call', return_value=text):
|
||||
print("open_editor_and_enter called")
|
||||
def _mock_editor_function(command):
|
||||
print("_mock_editor_function called")
|
||||
tmpfile = command.split()[-1]
|
||||
print("TMPFILE:", tmpfile)
|
||||
with open(tmpfile, "w+") as f:
|
||||
f.write(text)
|
||||
|
||||
with patch('subprocess.call', side_effect=_mock_editor_function):
|
||||
run(context, "jrnl")
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue