Cleanup last few tests

- Misc linting issues
- Whitespace cleanup
- Entire test suite is now passing
- Add misc todo items in comments

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
Jonathan Wren 2021-05-22 17:25:40 -07:00
parent 5572833652
commit 0c8efd5331
2 changed files with 9 additions and 12 deletions

View file

@ -33,16 +33,15 @@ Feature: Upgrading Journals from 1.x.x to 2.x.x
Scenario: Upgrade and parse journals with little endian date format Scenario: Upgrade and parse journals with little endian date format
Given we use the config "upgrade_from_195_little_endian_dates.json" Given we use the config "upgrade_from_195_little_endian_dates.json"
When we run "jrnl -9" and enter "Y" When we run "jrnl -9 --short" and enter "Y"
Then the output should be Then the output should contain
10.06.2010 15:00 A life without chocolate is like a bad analogy. 10.06.2010 15:00 A life without chocolate is like a bad analogy.
10.06.2013 15:40 He said "[this] is the best time to be alive". 10.06.2013 15:40 He said "[this] is the best time to be alive".
Scenario: Upgrade with missing journal Scenario: Upgrade with missing journal
Given we use the config "upgrade_from_195_with_missing_journal.json" Given we use the config "upgrade_from_195_with_missing_journal.json"
When we run "jrnl --list" and enter When we run "jrnl --list" and enter "Y"
Y Then the output should contain "Error: features/journals/missing.journal does not exist."
Then the error output should contain "Error: features/journals/missing.journal does not exist."
And we should get no error And we should get no error
Scenario: Upgrade with missing encrypted journal Scenario: Upgrade with missing encrypted journal
@ -50,6 +49,6 @@ Feature: Upgrading Journals from 1.x.x to 2.x.x
When we run "jrnl --list" and enter When we run "jrnl --list" and enter
Y Y
bad doggie no biscuit bad doggie no biscuit
Then the error output should contain "Error: features/journals/missing.journal does not exist." Then the output should contain "Error: features/journals/missing.journal does not exist."
And the error output should contain "We're all done" And the output should contain "We're all done"
And we should get no error And we should get no error

View file

@ -1,7 +1,6 @@
# Copyright (C) 2012-2021 jrnl contributors # Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html # License: https://www.gnu.org/licenses/gpl-3.0.html
import ast
import json import json
import os import os
from datetime import datetime from datetime import datetime
@ -406,6 +405,7 @@ def we_run(
# fmt: off # fmt: off
# see: https://github.com/psf/black/issues/664 # see: https://github.com/psf/black/issues/664
# @todo https://docs.python.org/3/library/contextlib.html#contextlib.ExitStack
with \ with \
patch("sys.argv", ['jrnl'] + args), \ patch("sys.argv", ['jrnl'] + args), \
patch("sys.stdin.read", side_effect=user_input) as mock_stdin, \ patch("sys.stdin.read", side_effect=user_input) as mock_stdin, \
@ -578,7 +578,7 @@ def journal_directory_should_contain(config_data, file_list):
@then(parse('journal "{journal_name}" should not exist')) @then(parse('journal "{journal_name}" should not exist'))
def journal_directory_should_contain(config_data, journal_name): def journal_directory_should_not_exist(config_data, journal_name):
scoped_config = scope_config(config_data, journal_name) scoped_config = scope_config(config_data, journal_name)
assert not does_directory_contain_files( assert not does_directory_contain_files(
@ -723,9 +723,7 @@ def assert_parsed_output_item_count(node_name, number, parsed_output):
@then(parse('"{field_name}" in the parsed output should {comparison}\n{expected_keys}')) @then(parse('"{field_name}" in the parsed output should {comparison}\n{expected_keys}'))
def assert_output_field_content( def assert_output_field_content(field_name, comparison, expected_keys, parsed_output):
field_name, comparison, expected_keys, cli_run, parsed_output
):
lang = parsed_output["lang"] lang = parsed_output["lang"]
obj = parsed_output["obj"] obj = parsed_output["obj"]
expected_keys = expected_keys.split("\n") expected_keys = expected_keys.split("\n")