Merge branch 'moar-tests' of https://github.com/wren/jrnl into moar-tests

This commit is contained in:
Micah Jerome Ellison 2020-09-24 20:46:15 -07:00
commit ea51fc5781
2 changed files with 56 additions and 17 deletions

View file

@ -1,38 +1,51 @@
Feature: Delete entries from journal Feature: Delete entries from journal
Scenario Outline: Delete flag allows deletion of single entry Scenario Outline: Delete flag allows deletion of single entry
Given we use the config "<config>.yaml" Given we use the config "<config>.yaml"
Then the journal should have 3 entries
When we run "jrnl -n 1" When we run "jrnl -n 1"
Then the output should contain "2019-10-29 11:13 Third entry." Then the output should contain "2020-09-24 09:14 The third entry finally"
When we run "jrnl --delete" and enter When we run "jrnl --delete" and enter
""" """
N N
N N
Y Y
""" """
Then the journal should have 2 entries Then we flush the output
When we run "jrnl -n 1" When we run "jrnl -99 --short"
Then the output should contain "2019-10-29 11:11 Second entry." Then the output should be
"""
2020-08-29 11:11 Entry the first.
2020-08-31 14:32 A second entry in what I hope to be a long series.
"""
Examples: Configs Examples: Configs
| config | | config |
| deletion | | basic_onefile |
| empty_folder | # | basic_folder | @todo
| dayone_empty | # | basic_dayone | @todo
Scenario: Backing out of interactive delete does not change journal Scenario Outline: Backing out of interactive delete does not change journal
Given we use the config "deletion.yaml" Given we use the config "<config>.yaml"
Then the journal should have 3 entries
When we run "jrnl --delete -n 1" and enter When we run "jrnl --delete -n 1" and enter
""" """
N N
""" """
Then the journal should have 3 entries Then we flush the output
And the journal should contain "[2019-10-29 11:11] First entry." When we run "jrnl -99 --short"
And the journal should contain "[2019-10-29 11:11] Second entry." Then the output should be
And the journal should contain "[2019-10-29 11:13] Third entry." """
2020-08-29 11:11 Entry the first.
2020-08-31 14:32 A second entry in what I hope to be a long series.
2020-09-24 09:14 The third entry finally after weeks without writing.
"""
Scenario: Delete flag with nonsense input deletes nothing (issue #932) Examples: Configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario Outline: Delete flag with nonsense input deletes nothing (issue #932)
Given we use the config "deletion.yaml" Given we use the config "deletion.yaml"
Then the journal should have 3 entries Then the journal should have 3 entries
When we run "jrnl --delete asdfasdf" When we run "jrnl --delete asdfasdf"
@ -40,6 +53,12 @@ Feature: Delete entries from journal
When we run "jrnl -n 1" When we run "jrnl -n 1"
Then the output should contain "2019-10-29 11:13 Third entry." Then the output should contain "2019-10-29 11:13 Third entry."
Examples: Configs
| config |
| basic_onefile |
| basic_folder |
| basic_dayone |
Scenario: Delete flag with tag only deletes tagged entries Scenario: Delete flag with tag only deletes tagged entries
Given we use the config "deletion_filters.yaml" Given we use the config "deletion_filters.yaml"
Then the journal should have 5 entries Then the journal should have 5 entries

View file

@ -355,6 +355,26 @@ def no_error(context):
assert context.exit_status == 0, context.exit_status assert context.exit_status == 0, context.exit_status
@then("we flush the output")
def flush_stdout(context):
context.stdout_capture.truncate(0)
context.stdout_capture.seek(0)
@then("we flush the error output")
def flush_stderr(context):
context.stderr_capture.truncate(0)
context.stderr_capture.seek(0)
@then("we flush all the output")
def flush_stderr(context):
context.execute_steps('''
Then we flush the output
Then we flush the error output
''')
@then("the output should be") @then("the output should be")
@then("the output should be empty") @then("the output should be empty")
@then('the output should be "{text}"') @then('the output should be "{text}"')