From 3b7e05c69f17a50528fc8caee7a8bb2238e9aeee Mon Sep 17 00:00:00 2001 From: Suhas Date: Thu, 28 Jan 2021 08:36:58 -0500 Subject: [PATCH] update tests ith better verifications --- features/steps/override.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/features/steps/override.py b/features/steps/override.py index d1857b0b..365e9795 100644 --- a/features/steps/override.py +++ b/features/steps/override.py @@ -71,8 +71,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): def _mock_write_in_editor(config): - editor = config["editor"] - journal = "features/journals/journal.jrnl" + editor = config['editor'] + journal = 'features/journals/journal.jrnl' context.tmpfile = journal print("%s has been launched" % editor) return journal @@ -101,20 +101,11 @@ def editor_override(context, editor): # fmt: on -@then("the stdin prompt must be launched") -def override_editor_to_use_stdin(context): - - try: - with mock.patch( - "sys.stdin.read", - return_value="Zwei peanuts walk into a bar und one of zem was a-salted", - ) as mock_stdin_read, mock.patch( - "jrnl.install.load_or_install_jrnl", return_value=context.cfg - ), mock.patch( - "jrnl.Journal.open_journal", - spec=False, - return_value="features/journals/journal.jrnl", - ): + try: + with \ + mock.patch('sys.stdin.read', return_value='Zwei peanuts walk into a bar und one of zem was a-salted')as mock_stdin_read, \ + mock.patch("jrnl.install.load_or_install_jrnl", return_value=context.cfg), \ + mock.patch("jrnl.Journal.open_journal", spec=False, return_value='features/journals/journal.jrnl'): run(context.parser) context.exit_status = 0 mock_stdin_read.assert_called_once()