update behave step to be more clear

This commit is contained in:
Jonathan Wren 2020-10-10 17:07:44 -07:00
parent 7368cd61cc
commit 93f383cb78
No known key found for this signature in database
GPG key ID: 43D5FF8722E7F68A
2 changed files with 8 additions and 12 deletions

View file

@ -403,11 +403,9 @@ Feature: Custom formats
When we run "jrnl --export yaml -o {cache_dir}" with cache directory "exported_journal"
Then cache directory "exported_journal" should contain the files
"""
[
"2020-08-29_entry-the-first.md",
"2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md",
"2020-09-24_the-third-entry-finally-after-weeks-without-writing.md"
]
2020-08-29_entry-the-first.md
2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md
2020-09-24_the-third-entry-finally-after-weeks-without-writing.md
"""
And the content of file "2020-08-29_entry-the-first.md" in cache directory "exported_journal" should be
"""
@ -452,11 +450,9 @@ Feature: Custom formats
When we run "jrnl --export yaml -o {cache_dir}" with cache directory "bug768"
Then cache directory "bug768" should contain the files
"""
[
"2020-08-29_entry-the-first.md",
"2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md",
"2020-09-24_the-third-entry-finally-after-weeks-without-writing.md"
]
2020-08-29_entry-the-first.md
2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md
2020-09-24_the-third-entry-finally-after-weeks-without-writing.md
"""
And the content of file "2020-09-24_the-third-entry-finally-after-weeks-without-writing.md" in cache directory "bug768" should be
"""

View file

@ -127,12 +127,12 @@ def create_directory(context, dir_name):
@then(
'cache directory "{dir_name}" should contain the files {expected_files_json_list}'
)
def assert_dir_contains_files(context, dir_name, expected_files_json_list="[]"):
def assert_dir_contains_files(context, dir_name, expected_files_json_list=""):
working_dir = os.path.join("features", "cache", dir_name)
actual_files = os.listdir(working_dir)
expected_files = context.text or expected_files_json_list
expected_files = json.loads(expected_files)
expected_files = expected_files.split("\n")
# sort to deal with inconsistent default file ordering on different OS's
actual_files.sort()