fix test that doesn't use a config file

This commit is contained in:
Jonathan Wren 2021-11-27 15:14:01 -08:00
parent 1304cc8e36
commit 733aad07b9
2 changed files with 9 additions and 1 deletions

View file

@ -32,6 +32,7 @@ Feature: Journals iteracting with the file system in a way that users can see
Then the output should contain "This is a new entry in my journal" Then the output should contain "This is a new entry in my journal"
Scenario: Creating journal with relative path should update to absolute path Scenario: Creating journal with relative path should update to absolute path
Given we use no config
When we run "jrnl hello world" and enter When we run "jrnl hello world" and enter
test.txt test.txt
n n

View file

@ -19,6 +19,7 @@ from jrnl.time import __get_pdt_calendar
from .fixtures import FailedKeyring from .fixtures import FailedKeyring
from .fixtures import TestKeyring from .fixtures import TestKeyring
from .helpers import get_fixture
@given(parse("we {editor_method} to the editor if opened\n{editor_input}")) @given(parse("we {editor_method} to the editor if opened\n{editor_input}"))
@ -77,10 +78,16 @@ def we_have_type_of_keyring(keyring_type):
@given(parse('we use the config "{config_file}"'), target_fixture="config_path") @given(parse('we use the config "{config_file}"'), target_fixture="config_path")
def we_use_the_config(config_file, temp_dir, working_dir): @given(parse("we use no config"), target_fixture="config_path")
def we_use_the_config(request, temp_dir, working_dir):
config_file = get_fixture(request, "config_file")
# Move into temp dir as cwd # Move into temp dir as cwd
os.chdir(temp_dir.name) os.chdir(temp_dir.name)
if not config_file:
return os.path.join(temp_dir.name, "non_existing_config.yaml")
# Copy the config file over # Copy the config file over
config_source = os.path.join(working_dir, "data", "configs", config_file) config_source = os.path.join(working_dir, "data", "configs", config_file)
config_dest = os.path.join(temp_dir.name, config_file) config_dest = os.path.join(temp_dir.name, config_file)