mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-18 03:58:32 +02:00
implement some missing steps in pytest-bdd
This commit is contained in:
parent
7f0bc2e5ed
commit
498d148c38
1 changed files with 18 additions and 0 deletions
|
@ -84,6 +84,14 @@ def output_should_contain_version(cli_run, toml_version):
|
|||
assert toml_version in out, toml_version
|
||||
|
||||
|
||||
@then(parse("the output should be {width:d} columns wide"))
|
||||
def output_should_be_columns_wide(cli_run, width):
|
||||
out = cli_run["stdout"]
|
||||
out_lines = out.splitlines()
|
||||
for line in out_lines:
|
||||
assert len(line) <= width
|
||||
|
||||
|
||||
@then(parse('we should see the message "{text}"'))
|
||||
def should_see_the_message(text, cli_run):
|
||||
out = cli_run["stderr"]
|
||||
|
@ -319,6 +327,16 @@ def count_editor_args(num_args, cli_run, editor_state, should_or_should_not):
|
|||
assert len(editor_state["command"]) == int(num_args)
|
||||
|
||||
|
||||
@then(parse("the stdin prompt {should_or_should_not} have been called"))
|
||||
def stdin_prompt_called(cli_run, should_or_should_not):
|
||||
we_should = parse_should_or_should_not(should_or_should_not)
|
||||
|
||||
if we_should:
|
||||
assert cli_run["mocks"]["stdin"].called
|
||||
else:
|
||||
assert not cli_run["mocks"]["stdin"].called
|
||||
|
||||
|
||||
@then(parse('the editor filename should end with "{suffix}"'))
|
||||
def editor_filename_suffix(suffix, editor_state):
|
||||
editor_filename = editor_state["tmpfile"]["name"]
|
||||
|
|
Loading…
Add table
Reference in a new issue