mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 13:08:31 +02:00
Properly use patched config path and add config given to scenario that wasn't using it
This commit is contained in:
parent
e8572014a7
commit
2894118d7c
2 changed files with 5 additions and 6 deletions
|
@ -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*)?"
|
Then the output should match "^jrnl version v\d+\.\d+(\.\d+)?(-(alpha|beta)\d*)?"
|
||||||
|
|
||||||
Scenario: Running the diagnostic command
|
Scenario: Running the diagnostic command
|
||||||
|
Given we use the config "simple.yaml"
|
||||||
When we run "jrnl --diagnostic"
|
When we run "jrnl --diagnostic"
|
||||||
Then the output should contain "jrnl"
|
Then the output should contain "jrnl"
|
||||||
And the output should contain "Python"
|
And the output should contain "Python"
|
||||||
|
|
|
@ -125,8 +125,6 @@ def read_value_from_string(string):
|
||||||
value = {"bool": lambda v: v.lower() == "true", "int": int, "str": str}[t](value)
|
value = {"bool": lambda v: v.lower() == "true", "int": int, "str": str}[t](value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def get_test_config_path(context):
|
|
||||||
return context.config_path
|
|
||||||
|
|
||||||
@given('we use the config "{config_file}"')
|
@given('we use the config "{config_file}"')
|
||||||
def set_config(context, 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("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
|
||||||
patch("sys.stdin.read", side_effect=text) as mock_read, \
|
patch("sys.stdin.read", side_effect=text) as mock_read, \
|
||||||
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
|
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.config.get_config_path", side_effect=lambda: context.config_path), \
|
||||||
patch("jrnl.install.get_config_path", side_effect=get_test_config_path(context)) \
|
patch("jrnl.install.get_config_path", side_effect=lambda: context.config_path) \
|
||||||
:
|
:
|
||||||
try:
|
try:
|
||||||
cli(args or [])
|
cli(args or [])
|
||||||
|
@ -392,8 +390,8 @@ def run(context, command, text=""):
|
||||||
patch("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
|
patch("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
|
||||||
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
|
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
|
||||||
patch("sys.stdin.read", side_effect=lambda: text), \
|
patch("sys.stdin.read", side_effect=lambda: text), \
|
||||||
patch("jrnl.config.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=get_test_config_path(context)) \
|
patch("jrnl.install.get_config_path", side_effect=lambda: context.config_path) \
|
||||||
:
|
:
|
||||||
context.editor = mock_editor
|
context.editor = mock_editor
|
||||||
context.getpass = mock_getpass
|
context.getpass = mock_getpass
|
||||||
|
|
Loading…
Add table
Reference in a new issue