diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-02-08 10:23:48 -0500 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2017-02-08 10:23:48 -0500 |
commit | 04ea66c4ab6cd1e5daa217526d7c9591aa164f10 (patch) | |
tree | af513224a29ed2d6d0e7f73a22428dec65258997 /roles/lib_openshift/src/test/unit/oc_scale.py | |
parent | 76b99082bddf9f8e24063e5d2553b144e13d5984 (diff) | |
download | openshift-04ea66c4ab6cd1e5daa217526d7c9591aa164f10.tar.gz openshift-04ea66c4ab6cd1e5daa217526d7c9591aa164f10.tar.bz2 openshift-04ea66c4ab6cd1e5daa217526d7c9591aa164f10.tar.xz openshift-04ea66c4ab6cd1e5daa217526d7c9591aa164f10.zip |
Added temporary kubeconfig file. Fixed tests to coincide with tmpfile.
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']) |