Module: cli_bdd.core.steps.command

run_command

Runs a command.

Examples:

When I run `echo hello`

Matcher:

I run `(?P<command>[^`]*)`

successfully_run_command

Runs a command and checks it for successfull status.

Examples:

When I successfully run `echo hello`

Matcher:

I successfully run `(?P<command>.*)`

run_command_interactively

Runs a command in interactive mode.

Examples:

When I run `rm -i hello.txt` interactively

Matcher:

I run `(?P<command>[^`]*)` interactively

type_into_command

Types an input into the previously ran in interactive mode command.

Examples:

When I type "Yes"

Matcher:

I type "(?P<input_>[^"]*)"

got_interactive_dialog

Waits for a dialog.

By default waits for 1 second. Timeout could be changed by providing in N seconds information.

Examples:

When I got "Password:" for interactive dialog
When I got "Password:" for interactive dialog in 1 second
When I got "Name .*: " for interactive dialog in 0.01 seconds

Matcher:

I got "(?P<dialog_matcher>[^"]*)" for interactive dialog( in (?P<timeout>(\d*[.])?\d+) seconds?)?

output_should_contain_text

Checks the command output (stdout, stderr).

Examples:

Then the output should contain:
    """
    hello
    """

Then the output should contain exactly:
    """
    hello
    """

Then the stderr should not contain exactly:
    """
    hello
    """

Matcher:

the (?P<output>(output|stderr|stdout)) should( (?P<should_not>not))? contain( (?P<exactly>exactly))?

output_should_contain_lines

Checks the command output number of lines.

Examples:

Then the output should contain 3 lines
Then the output should not contain 3 lines
Then the output should contain up to 3 lines
Then the output should contain less than 3 lines
Then the output should contain at least 1 line
Then the output should contain more than 1 line

Matcher:

the (?P<output>(output|stderr|stdout)) should( (?P<should_not>not))? contain( (?P<comparison>(up to|at least|more than|less than)))? (?P<count>\d+) lines?

exit_status_should_be

Checks the command status code.

Examples:

Then the exit status should be 1
Then the exit status should not be 1

Matcher:

the exit status should( (?P<should_not>not))? be (?P<exit_status>\d+)