diff options
author | Rodolfo Carvalho <rhcarvalho@gmail.com> | 2017-03-22 21:05:18 +0100 |
---|---|---|
committer | Rodolfo Carvalho <rhcarvalho@gmail.com> | 2017-03-28 11:54:52 +0200 |
commit | 209810c9905c0ebf89b1e03ccb8593f78a6e5396 (patch) | |
tree | 79fd109c6cd565d1ac1d8e7ae87a2066e565a710 /roles/openshift_health_checker | |
parent | 0af4d72753fa411ddbd17e180aca2c3f4a4df9a6 (diff) | |
download | openshift-209810c9905c0ebf89b1e03ccb8593f78a6e5396.tar.gz openshift-209810c9905c0ebf89b1e03ccb8593f78a6e5396.tar.bz2 openshift-209810c9905c0ebf89b1e03ccb8593f78a6e5396.tar.xz openshift-209810c9905c0ebf89b1e03ccb8593f78a6e5396.zip |
Add unit tests for mixins.py
Diffstat (limited to 'roles/openshift_health_checker')
-rw-r--r-- | roles/openshift_health_checker/test/mixins_test.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/roles/openshift_health_checker/test/mixins_test.py b/roles/openshift_health_checker/test/mixins_test.py new file mode 100644 index 000000000..2d83e207d --- /dev/null +++ b/roles/openshift_health_checker/test/mixins_test.py @@ -0,0 +1,23 @@ +import pytest + +from openshift_checks import OpenShiftCheck, OpenShiftCheckException +from openshift_checks.mixins import NotContainerizedMixin + + +class NotContainerizedCheck(NotContainerizedMixin, OpenShiftCheck): + name = "not_containerized" + run = NotImplemented + + +@pytest.mark.parametrize('task_vars,expected', [ + (dict(openshift=dict(common=dict(is_containerized=False))), True), + (dict(openshift=dict(common=dict(is_containerized=True))), False), +]) +def test_is_active(task_vars, expected): + assert NotContainerizedCheck.is_active(task_vars) == expected + + +def test_is_active_missing_task_vars(): + with pytest.raises(OpenShiftCheckException) as excinfo: + NotContainerizedCheck.is_active(task_vars={}) + assert 'is_containerized' in str(excinfo.value) |