-
Notifications
You must be signed in to change notification settings - Fork 681
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stepan Blyschak <[email protected]>
- Loading branch information
1 parent
cc89a02
commit 4fae05e
Showing
2 changed files
with
30 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
import show.main | ||
from unittest.mock import patch, Mock | ||
from click.testing import CliRunner | ||
|
||
EXPECTED_BASE_COMMAND = 'sudo timeout --kill-after=300s -s SIGTERM --foreground ' | ||
|
||
@patch("show.main.run_command") | ||
@pytest.mark.parametrize( | ||
"cli_arguments,expected", | ||
[ | ||
([], '30m generate_dump -v -t 5'), | ||
(['--since', '2 days ago'], "30m generate_dump -v -s '2 days ago' -t 5"), | ||
(['-g', '50'], '50m generate_dump -v -t 5'), | ||
(['--allow-process-stop'], '30m -a generate_dump -v -t 5'), | ||
(['--silent'], '30m generate_dump -t 5'), | ||
(['--debug-dump', '--redirect-stderr'], '30m generate_dump -v -d -t 5 -r'), | ||
] | ||
) | ||
def test_techsupport(run_command, cli_arguments, expected): | ||
runner = CliRunner() | ||
result = runner.invoke(show.main.cli.commands['techsupport'], cli_arguments) | ||
run_command.assert_called_with(EXPECTED_BASE_COMMAND + expected, display_cmd=False) | ||
|