summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorRodolfo Carvalho <rhcarvalho@gmail.com>2017-03-22 16:52:37 +0100
committerRodolfo Carvalho <rhcarvalho@gmail.com>2017-03-28 11:54:52 +0200
commit0af4d72753fa411ddbd17e180aca2c3f4a4df9a6 (patch)
treee9516cfb214cf2d8fdc10ec4ea70be5314402a04 /roles
parent4b657031ff309cb8b004cd7fbd44ae479ce09432 (diff)
downloadopenshift-0af4d72753fa411ddbd17e180aca2c3f4a4df9a6.tar.gz
openshift-0af4d72753fa411ddbd17e180aca2c3f4a4df9a6.tar.bz2
openshift-0af4d72753fa411ddbd17e180aca2c3f4a4df9a6.tar.xz
openshift-0af4d72753fa411ddbd17e180aca2c3f4a4df9a6.zip
Test recursively finding subclasses
Diffstat (limited to 'roles')
-rw-r--r--roles/openshift_health_checker/test/openshift_check_test.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/roles/openshift_health_checker/test/openshift_check_test.py b/roles/openshift_health_checker/test/openshift_check_test.py
index 03465a7c3..e3153979c 100644
--- a/roles/openshift_health_checker/test/openshift_check_test.py
+++ b/roles/openshift_health_checker/test/openshift_check_test.py
@@ -58,6 +58,23 @@ def test_OpenShiftCheck_init():
assert check.module_executor == execute_module
+def test_subclasses():
+ """OpenShiftCheck.subclasses should find all subclasses recursively."""
+ class TestCheck1(OpenShiftCheck):
+ pass
+
+ class TestCheck2(OpenShiftCheck):
+ pass
+
+ class TestCheck1A(TestCheck1):
+ pass
+
+ local_subclasses = set([TestCheck1, TestCheck1A, TestCheck2])
+ known_subclasses = set(OpenShiftCheck.subclasses())
+
+ assert local_subclasses - known_subclasses == set(), "local_subclasses should be a subset of known_subclasses"
+
+
def test_load_checks():
"""Loading checks should load and return Python modules."""
modules = load_checks()