Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check_sql: refactored arguments str to list + create unit check test
CMK-873 Change-Id: Iec31fa411c991ebcb20fbff9582efbc65cfa18dd
- Loading branch information
Jonas Kluger
committed
Jun 25, 2019
1 parent
2aa134a
commit e133627
Showing
2 changed files
with
37 additions
and
20 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,22 @@ | ||
import pytest | ||
|
||
pytestmark = pytest.mark.checks | ||
|
||
|
||
@pytest.mark.parametrize("params,expected_args", [ | ||
({ | ||
"description": "foo", | ||
"dbms": "postgres", | ||
"name": "bar", | ||
"user": "hans", | ||
"password": "wurst", | ||
"sql": ("") | ||
}, [ | ||
"--hostname=$HOSTADDRESS$", "--dbms=postgres", "--name=bar", "--user=hans", | ||
"--password=wurst", "" | ||
]), | ||
]) | ||
def test_check_sql_argument_parsing(check_manager, params, expected_args): | ||
"""Tests if all required arguments are present.""" | ||
active_check = check_manager.get_active_check("check_sql") | ||
assert active_check.run_argument_function(params) == expected_args |