diff options
author | Scott Dodson <sdodson@redhat.com> | 2017-02-08 12:19:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-08 12:19:45 -0500 |
commit | bf1b4def44894ddc71d35e28c48c56078f90b947 (patch) | |
tree | af513224a29ed2d6d0e7f73a22428dec65258997 /roles/lib_openshift/src/test/unit/oc_scale.py | |
parent | b1565e9e843e99c6b3c0d99518c27249472f57fe (diff) | |
parent | 04ea66c4ab6cd1e5daa217526d7c9591aa164f10 (diff) | |
download | openshift-bf1b4def44894ddc71d35e28c48c56078f90b947.tar.gz openshift-bf1b4def44894ddc71d35e28c48c56078f90b947.tar.bz2 openshift-bf1b4def44894ddc71d35e28c48c56078f90b947.tar.xz openshift-bf1b4def44894ddc71d35e28c48c56078f90b947.zip |
Merge pull request #3290 from kwoodson/tmp_admin_kubeconfig
Added tmpfile for kubeconfig. Fixed tests.
Diffstat (limited to 'roles/lib_openshift/src/test/unit/oc_scale.py')
-rwxr-xr-x | roles/lib_openshift/src/test/unit/oc_scale.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/roles/lib_openshift/src/test/unit/oc_scale.py b/roles/lib_openshift/src/test/unit/oc_scale.py index d8d5a231f..f15eb164d 100755 --- a/roles/lib_openshift/src/test/unit/oc_scale.py +++ b/roles/lib_openshift/src/test/unit/oc_scale.py @@ -35,8 +35,9 @@ class OCScaleTest(unittest.TestCase): ''' setup method will create a file and set to known configuration ''' pass + @mock.patch('oc_scale.Utils.create_tmpfile_copy') @mock.patch('oc_scale.OCScale.openshift_cmd') - def test_state_list(self, mock_openshift_cmd): + def test_state_list(self, mock_openshift_cmd, mock_tmpfile_copy): ''' Testing a get ''' params = {'name': 'router', 'namespace': 'default', @@ -70,13 +71,18 @@ class OCScaleTest(unittest.TestCase): 'results': dc, 'returncode': 0}] + mock_tmpfile_copy.side_effect = [ + '/tmp/mocked_kubeconfig', + ] + results = OCScale.run_ansible(params, False) self.assertFalse(results['changed']) self.assertEqual(results['result'][0], 2) + @mock.patch('oc_scale.Utils.create_tmpfile_copy') @mock.patch('oc_scale.OCScale.openshift_cmd') - def test_scale(self, mock_openshift_cmd): + def test_scale(self, mock_openshift_cmd, mock_tmpfile_copy): ''' Testing a get ''' params = {'name': 'router', 'namespace': 'default', @@ -114,13 +120,18 @@ class OCScaleTest(unittest.TestCase): 'returncode': 0} ] + mock_tmpfile_copy.side_effect = [ + '/tmp/mocked_kubeconfig', + ] + results = OCScale.run_ansible(params, False) self.assertFalse(results['changed']) self.assertEqual(results['result'][0], 3) + @mock.patch('oc_scale.Utils.create_tmpfile_copy') @mock.patch('oc_scale.OCScale.openshift_cmd') - def test_no_dc_scale(self, mock_openshift_cmd): + def test_no_dc_scale(self, mock_openshift_cmd, mock_tmpfile_copy): ''' Testing a get ''' params = {'name': 'not_there', 'namespace': 'default', @@ -138,6 +149,10 @@ class OCScaleTest(unittest.TestCase): 'stdout': ""}, ] + mock_tmpfile_copy.side_effect = [ + '/tmp/mocked_kubeconfig', + ] + results = OCScale.run_ansible(params, False) self.assertTrue(results['failed']) |