From 39607fb86f992253b600b8563d6c6c971fd42fb7 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Tue, 18 Apr 2017 17:08:21 +0200 Subject: Add missing mock for locate_oc_binary method When locate_oc_binary has not been mocked, the test suite fails when oc executable is available. --- roles/lib_openshift/src/test/unit/test_oc_adm_registry.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'roles/lib_openshift/src/test/unit/test_oc_adm_registry.py') diff --git a/roles/lib_openshift/src/test/unit/test_oc_adm_registry.py b/roles/lib_openshift/src/test/unit/test_oc_adm_registry.py index bab36fddc..a095d59c0 100755 --- a/roles/lib_openshift/src/test/unit/test_oc_adm_registry.py +++ b/roles/lib_openshift/src/test/unit/test_oc_adm_registry.py @@ -205,10 +205,11 @@ class RegistryTest(unittest.TestCase): } ]}''' + @mock.patch('oc_adm_registry.locate_oc_binary') @mock.patch('oc_adm_registry.Utils._write') @mock.patch('oc_adm_registry.Utils.create_tmpfile_copy') @mock.patch('oc_adm_registry.Registry._run') - def test_state_present(self, mock_cmd, mock_tmpfile_copy, mock_write): + def test_state_present(self, mock_cmd, mock_tmpfile_copy, mock_write, mock_oc_binary): ''' Testing state present ''' params = {'state': 'present', 'debug': False, @@ -245,6 +246,11 @@ class RegistryTest(unittest.TestCase): '/tmp/mocked_kubeconfig', ] + mock_oc_binary.side_effect = [ + 'oc', + 'oc', + ] + results = Registry.run_ansible(params, False) self.assertTrue(results['changed']) -- cgit v1.2.1