From ca2eaab70716a23d1d8064d16d183cb7f2ffc898 Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Mon, 27 Mar 2017 15:08:10 +0200 Subject: Add unit tests for package_version.py --- .../test/package_version_test.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 roles/openshift_health_checker/test/package_version_test.py (limited to 'roles/openshift_health_checker') diff --git a/roles/openshift_health_checker/test/package_version_test.py b/roles/openshift_health_checker/test/package_version_test.py new file mode 100644 index 000000000..cc1d263bc --- /dev/null +++ b/roles/openshift_health_checker/test/package_version_test.py @@ -0,0 +1,21 @@ +from openshift_checks.package_version import PackageVersion + + +def test_package_version(): + task_vars = dict( + openshift=dict(common=dict(service_type='origin')), + openshift_release='v3.5', + ) + return_value = object() + + def execute_module(module_name=None, module_args=None, tmp=None, task_vars=None): + assert module_name == 'aos_version' + assert 'prefix' in module_args + assert 'version' in module_args + assert module_args['prefix'] == task_vars['openshift']['common']['service_type'] + assert module_args['version'] == task_vars['openshift_release'] + return return_value + + check = PackageVersion(execute_module=execute_module) + result = check.run(tmp=None, task_vars=task_vars) + assert result is return_value -- cgit v1.2.3