diff options
author | Rodolfo Carvalho <rhcarvalho@gmail.com> | 2017-03-22 16:29:37 +0100 |
---|---|---|
committer | Rodolfo Carvalho <rhcarvalho@gmail.com> | 2017-03-28 11:54:52 +0200 |
commit | 5e71e43a2a2e9089185d34e5406ee212cc478a75 (patch) | |
tree | 0b62a54db72e5614998ea2aa29517eb3f8296294 /roles/openshift_health_checker/test | |
parent | f324d6d1040b6af82113a1e975903ae8fd64fef8 (diff) | |
download | openshift-5e71e43a2a2e9089185d34e5406ee212cc478a75.tar.gz openshift-5e71e43a2a2e9089185d34e5406ee212cc478a75.tar.bz2 openshift-5e71e43a2a2e9089185d34e5406ee212cc478a75.tar.xz openshift-5e71e43a2a2e9089185d34e5406ee212cc478a75.zip |
Rename module_executor -> execute_module
It is a function/callable, the name should imply action, should be a
verb and not a noun.
Keep supporting the old name while we have PRs in-flight that use the
old name.
Diffstat (limited to 'roles/openshift_health_checker/test')
-rw-r--r-- | roles/openshift_health_checker/test/openshift_check_test.py | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/roles/openshift_health_checker/test/openshift_check_test.py b/roles/openshift_health_checker/test/openshift_check_test.py index c4c8cd1c2..9cbd5b11e 100644 --- a/roles/openshift_health_checker/test/openshift_check_test.py +++ b/roles/openshift_health_checker/test/openshift_check_test.py @@ -1,6 +1,6 @@ import pytest -from openshift_checks import get_var, OpenShiftCheckException +from openshift_checks import OpenShiftCheck, get_var, OpenShiftCheckException # Fixtures @@ -22,6 +22,41 @@ def missing_keys(request): # Tests +def test_OpenShiftCheck_init(): + class TestCheck(OpenShiftCheck): + name = "test_check" + run = NotImplemented + + # initialization requires at least one argument (apart from self) + with pytest.raises(TypeError) as excinfo: + TestCheck() + assert 'execute_module' in str(excinfo.value) + assert 'module_executor' in str(excinfo.value) + + execute_module = object() + + # initialize with positional argument + check = TestCheck(execute_module) + # new recommended name + assert check.execute_module == execute_module + # deprecated attribute name + assert check.module_executor == execute_module + + # initialize with keyword argument, recommended name + check = TestCheck(execute_module=execute_module) + # new recommended name + assert check.execute_module == execute_module + # deprecated attribute name + assert check.module_executor == execute_module + + # initialize with keyword argument, deprecated name + check = TestCheck(module_executor=execute_module) + # new recommended name + assert check.execute_module == execute_module + # deprecated attribute name + assert check.module_executor == execute_module + + @pytest.mark.parametrize("keys,expected", [ (("foo",), 42), (("bar", "baz"), "openshift"), |