Add ability to use template with --template (#1667)

* Add ability to pass template path with --template

Update jrnl/args.py

* Fix tests
This commit is contained in:
Aaron Lichtman 2023-03-25 11:47:00 -07:00 committed by GitHub
parent 0725ea6b87
commit a2b217fdfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 217 additions and 68 deletions

View file

@ -89,6 +89,7 @@ def cli_run(
mock_user_input,
mock_overrides,
mock_default_journal_path,
mock_default_templates_path,
):
# Check if we need more mocks
mock_factories.update(mock_args)
@ -98,6 +99,7 @@ def cli_run(
mock_factories.update(mock_config_path)
mock_factories.update(mock_user_input)
mock_factories.update(mock_default_journal_path)
mock_factories.update(mock_default_templates_path)
return {
"status": 0,
@ -179,6 +181,16 @@ def mock_default_journal_path(temp_dir):
}
@fixture
def mock_default_templates_path(temp_dir):
templates_path = Path(temp_dir.name, "templates")
return {
"get_templates_path": lambda: patch(
"jrnl.controller.get_templates_path", return_value=templates_path
),
}
@fixture
def temp_dir():
return tempfile.TemporaryDirectory()