Add test for aborting jrnl entry from editor

This commit is contained in:
Aaron Lichtman 2019-11-15 09:27:01 +01:00
parent 2890e33cac
commit 7a90f4076d
No known key found for this signature in database
GPG key ID: 22368077DE9F9903
5 changed files with 44 additions and 1 deletions

View file

@ -6,6 +6,7 @@ from jrnl import cli, install, Journal, util, plugins
from jrnl import __version__
from dateutil import parser as date_parser
from collections import defaultdict
import mock
import os
import json
import yaml
@ -27,6 +28,7 @@ class TestKeyring(keyring.backend.KeyringBackend):
def delete_password(self, servicename, username, password):
self.keys[servicename][username] = None
# set the keyring for keyring lib
keyring.set_keyring(TestKeyring())
@ -73,6 +75,12 @@ def set_config(context, config_file):
cf.write("version: {}".format(__version__))
@when('we open the editor and exit')
@mock.patch('jrnl.util.get_text_from_editor', return_value="")
def open_editor_and_exit_without_entering_text(context, dead_param_to_satisfy_behave):
run(context, "jrnl")
@when('we run "{command}" and enter')
@when('we run "{command}" and enter "{inputs}"')
def run_with_input(context, command, inputs=None):
@ -166,6 +174,11 @@ def check_json_output_path(context, path, value):
assert struct == value, struct
@then('the output should be empty')
def check_empty_output(context, text=None):
assert (text or context.text) is None
@then('the output should be')
@then('the output should be "{text}"')
def check_output(context, text=None):