mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-27 21:16:14 +02:00
Export to file(s) when first line/title of an entry is very long (#1527)
This commit is contained in:
parent
c92ee47632
commit
fb473007da
4 changed files with 58 additions and 3 deletions
|
@ -17,6 +17,21 @@ def does_directory_contain_files(file_list, directory_path):
|
|||
return True
|
||||
|
||||
|
||||
def does_directory_contain_n_files(directory_path, number):
|
||||
count = 0
|
||||
if not os.path.isdir(directory_path):
|
||||
return False
|
||||
|
||||
files = [
|
||||
f
|
||||
for f in os.listdir(directory_path)
|
||||
if os.path.isfile(os.path.join(directory_path, f))
|
||||
]
|
||||
count = len(files)
|
||||
|
||||
return int(number) == count
|
||||
|
||||
|
||||
def parse_should_or_should_not(should_or_should_not):
|
||||
if should_or_should_not == "should":
|
||||
return True
|
||||
|
|
|
@ -13,6 +13,7 @@ from ruamel.yaml import YAML
|
|||
from jrnl.config import scope_config
|
||||
from tests.lib.helpers import assert_equal_tags_ignoring_order
|
||||
from tests.lib.helpers import does_directory_contain_files
|
||||
from tests.lib.helpers import does_directory_contain_n_files
|
||||
from tests.lib.helpers import get_nested_val
|
||||
from tests.lib.helpers import parse_should_or_should_not
|
||||
|
||||
|
@ -201,6 +202,11 @@ def assert_dir_contains_files(file_list, cache_dir):
|
|||
assert does_directory_contain_files(file_list, cache_dir["path"])
|
||||
|
||||
|
||||
@then(parse("the cache directory should contain {number} files"))
|
||||
def assert_dir_contains_n_files(cache_dir, number):
|
||||
assert does_directory_contain_n_files(cache_dir["path"], number)
|
||||
|
||||
|
||||
@then(parse("the journal directory should contain\n{file_list}"))
|
||||
def journal_directory_should_contain(config_on_disk, file_list):
|
||||
scoped_config = scope_config(config_on_disk, "default")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue