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
Given we use the config "upgrade_from_195_little_endian_dates.json"
When we run "jrnl -9" and enter "Y"
Then the output should be
When we run "jrnl -9 --short" and enter "Y"
Then the output should contain
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".
Scenario: Upgrade with missing journal
Given we use the config "upgrade_from_195_with_missing_journal.json"
When we run "jrnl --list" and enter
Y
Then the error output should contain "Error: features/journals/missing.journal does not exist."
When we run "jrnl --list" and enter "Y"
Then the output should contain "Error: features/journals/missing.journal does not exist."
And we should get no error
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
Y
bad doggie no biscuit
Then the error output should contain "Error: features/journals/missing.journal does not exist."
And the error output should contain "We're all done"
Then the output should contain "Error: features/journals/missing.journal does not exist."
And the output should contain "We're all done"
And we should get no error

View file

@ -1,7 +1,6 @@
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
import ast
import json
import os
from datetime import datetime
@ -406,6 +405,7 @@ def we_run(
# fmt: off
# see: https://github.com/psf/black/issues/664
# @todo https://docs.python.org/3/library/contextlib.html#contextlib.ExitStack
with \
patch("sys.argv", ['jrnl'] + args), \
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'))
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)
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}'))
def assert_output_field_content(
field_name, comparison, expected_keys, cli_run, parsed_output
):
def assert_output_field_content(field_name, comparison, expected_keys, parsed_output):
lang = parsed_output["lang"]
obj = parsed_output["obj"]
expected_keys = expected_keys.split("\n")