Properly use patched config path and add config given to scenario that wasn't using it

This commit is contained in:
Micah Jerome Ellison 2020-12-26 15:04:08 -08:00
parent e8572014a7
commit 2894118d7c
2 changed files with 5 additions and 6 deletions

View file

@ -13,6 +13,7 @@ Feature: Functionality of jrnl outside of actually handling journals
Then the output should match "^jrnl version v\d+\.\d+(\.\d+)?(-(alpha|beta)\d*)?"
Scenario: Running the diagnostic command
Given we use the config "simple.yaml"
When we run "jrnl --diagnostic"
Then the output should contain "jrnl"
And the output should contain "Python"

View file

@ -125,8 +125,6 @@ def read_value_from_string(string):
value = {"bool": lambda v: v.lower() == "true", "int": int, "str": str}[t](value)
return value
def get_test_config_path(context):
return context.config_path
@given('we use the config "{config_file}"')
def set_config(context, config_file):
@ -308,8 +306,8 @@ def run_with_input(context, command, inputs=""):
patch("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
patch("sys.stdin.read", side_effect=text) as mock_read, \
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
patch("jrnl.config.get_config_path", side_effect=get_test_config_path(context)), \
patch("jrnl.install.get_config_path", side_effect=get_test_config_path(context)) \
patch("jrnl.config.get_config_path", side_effect=lambda: context.config_path), \
patch("jrnl.install.get_config_path", side_effect=lambda: context.config_path) \
:
try:
cli(args or [])
@ -392,8 +390,8 @@ def run(context, command, text=""):
patch("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
patch("sys.stdin.read", side_effect=lambda: text), \
patch("jrnl.config.get_config_path", side_effect=get_test_config_path(context)), \
patch("jrnl.install.get_config_path", side_effect=get_test_config_path(context)) \
patch("jrnl.config.get_config_path", side_effect=lambda: context.config_path), \
patch("jrnl.install.get_config_path", side_effect=lambda: context.config_path) \
:
context.editor = mock_editor
context.getpass = mock_getpass