From 67417c7806971fd6f6ac435e6ae0d9fc2d8b3913 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Fri, 14 Jan 2022 06:24:11 -0800 Subject: [PATCH] unskip blank input test --- tests/bdd/features/write.feature | 18 +++++++++--------- tests/lib/when_steps.py | 7 +++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/bdd/features/write.feature b/tests/bdd/features/write.feature index a2c2a85b..49a96e6e 100644 --- a/tests/bdd/features/write.feature +++ b/tests/bdd/features/write.feature @@ -89,21 +89,21 @@ Feature: Writing new entries. | basic_encrypted.yaml | | basic_onefile.yaml | - @skip Scenario Outline: Writing an empty entry from the command line with no editor should yield nothing Given we use the config "" - And we use the password "bad doggie no biscuit" if prompted - When we run "jrnl" and enter nothing - Then the output should be empty + And we use the password "test" if prompted + When we run "jrnl --config-override editor ''" and enter "" + Then the stdin prompt should have been called + And the output should be empty And the error output should contain "Writing Entry; on a blank line" And the editor should not have been called Examples: configs - | config_file | - | config_simple.yaml | - | empty_folder.yaml | - | encrypted.yaml | - # | dayone | @todo + | config_file | + | basic_onefile.yaml | + | basic_encrypted.yaml | + | basic_folder.yaml | + # | basic_dayone.yaml | @todo Scenario Outline: Writing an entry does not print the entire journal # https://github.com/jrnl-org/jrnl/issues/87 diff --git a/tests/lib/when_steps.py b/tests/lib/when_steps.py index c1d391a5..60302c7c 100644 --- a/tests/lib/when_steps.py +++ b/tests/lib/when_steps.py @@ -20,14 +20,13 @@ def when_we_change_directory(directory_name): # These variables are used in the `@when(re(...))` section below -command = '(?P[^"]+)' +command = '(?P[^"]*)' input_method = "(?Penter|pipe)" -user_input = '(?P[^"]+)' +user_input = '("(?P[^"]*)")' @when(parse('we run "jrnl {command}" and {input_method}\n{user_input}')) -@when(re(f'we run "jrnl {command}" and {input_method} "{user_input}"')) -@when(re(f'we run "jrnl" and {input_method} "{user_input}"')) +@when(re(f'we run "jrnl ?{command}" and {input_method} {user_input}')) @when(parse('we run "jrnl {command}"')) @when('we run "jrnl"') def we_run_jrnl(cli_run, capsys, keyring):