mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
Add more password tests to pytest-bdd
Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
parent
10b604ef89
commit
c76ee8cd4f
2 changed files with 29 additions and 9 deletions
|
@ -77,3 +77,15 @@ Feature: Using the installed keyring
|
|||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
|
||||
|
||||
Scenario: Open encrypted journal when keyring exists but fails
|
||||
# This should ask the user for the password after the keyring fails
|
||||
Given we use the config "encrypted.yaml"
|
||||
And we have a failed keyring
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl -n 1"
|
||||
Then we should get no error
|
||||
And we should be prompted for a password
|
||||
And the output should contain "Failed to retrieve keyring"
|
||||
And the output should contain "2013-06-10 15:40 Life is good"
|
||||
|
||||
|
|
|
@ -149,8 +149,8 @@ def journal_name():
|
|||
|
||||
|
||||
@fixture
|
||||
def output_to_error():
|
||||
return False
|
||||
def which_output_stream():
|
||||
return None
|
||||
|
||||
|
||||
# ----- STEPS ----- #
|
||||
|
@ -256,13 +256,21 @@ def output_should_match(regex, cli_run):
|
|||
@then(parse("the output should contain\n{output}"))
|
||||
@then(parse('the output should contain "{output}"'))
|
||||
@then('the output should contain "<output>"')
|
||||
@then(parse("the {output_to_error} output should contain\n{output}"))
|
||||
@then(parse('the {output_to_error} output should contain "{output}"'))
|
||||
def output_should_contain(output, output_to_error, cli_run):
|
||||
assert output and (
|
||||
(output_to_error and output in cli_run["stderr"])
|
||||
or (not output_to_error and output in cli_run["stdout"])
|
||||
)
|
||||
@then(parse("the {which_output_stream} output should contain\n{output}"))
|
||||
@then(parse('the {which_output_stream} output should contain "{output}"'))
|
||||
def output_should_contain(output, which_output_stream, cli_run):
|
||||
assert output
|
||||
if which_output_stream is None:
|
||||
assert (output in cli_run["stdout"]) or (output in cli_run["stderr"])
|
||||
|
||||
elif which_output_stream == "standard":
|
||||
assert output in cli_run["stdout"]
|
||||
|
||||
elif which_output_stream == "error":
|
||||
assert output in cli_run["stderr"]
|
||||
|
||||
else:
|
||||
assert output in cli_run[which_output_stream]
|
||||
|
||||
|
||||
@then(parse("the output should not contain\n{output}"))
|
||||
|
|
Loading…
Add table
Reference in a new issue