mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-18 12:08:31 +02:00
add 'the editor should not have been called' step
This commit is contained in:
parent
76840b4d2c
commit
0c6cb58d25
2 changed files with 14 additions and 4 deletions
|
@ -5,6 +5,7 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
||||||
And we use the password "test" if prompted
|
And we use the password "test" if prompted
|
||||||
When we run "jrnl --config-override editor ''"
|
When we run "jrnl --config-override editor ''"
|
||||||
Then the stdin prompt should have been called
|
Then the stdin prompt should have been called
|
||||||
|
And the editor should not have been called
|
||||||
|
|
||||||
|
|
||||||
Scenario: Postconfig commands with overrides
|
Scenario: Postconfig commands with overrides
|
||||||
|
|
|
@ -301,10 +301,19 @@ def count_elements(number, item, cli_run):
|
||||||
assert len(xml_tree.findall(".//" + item)) == number
|
assert len(xml_tree.findall(".//" + item)) == number
|
||||||
|
|
||||||
|
|
||||||
@then(parse("the editor should have been called"))
|
@then(parse("the editor {should_or_should_not} have been called"))
|
||||||
@then(parse("the editor should have been called with {num_args} arguments"))
|
@then(
|
||||||
def count_editor_args(num_args, cli_run, editor_state):
|
parse(
|
||||||
|
"the editor {should_or_should_not} have been called with {num_args} arguments"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
def count_editor_args(num_args, cli_run, editor_state, should_or_should_not):
|
||||||
|
we_should = parse_should_or_should_not(should_or_should_not)
|
||||||
|
|
||||||
|
if we_should:
|
||||||
assert cli_run["mocks"]["editor"].called
|
assert cli_run["mocks"]["editor"].called
|
||||||
|
else:
|
||||||
|
assert not cli_run["mocks"]["editor"].called
|
||||||
|
|
||||||
if isinstance(num_args, int):
|
if isinstance(num_args, int):
|
||||||
assert len(editor_state["command"]) == int(num_args)
|
assert len(editor_state["command"]) == int(num_args)
|
||||||
|
|
Loading…
Add table
Reference in a new issue