diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-02-16 14:13:26 -0500 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2017-02-16 14:34:34 -0500 |
commit | 42af186c6f961a9a7cd76abc4ac423d9141bded2 (patch) | |
tree | 34a99e1c8c851e8a05fcbfe01722df3652c867d8 /roles/lib_openshift/src | |
parent | 43330fbd7cb90491d63e54430394a309f7a41f73 (diff) | |
download | openshift-42af186c6f961a9a7cd76abc4ac423d9141bded2.tar.gz openshift-42af186c6f961a9a7cd76abc4ac423d9141bded2.tar.bz2 openshift-42af186c6f961a9a7cd76abc4ac423d9141bded2.tar.xz openshift-42af186c6f961a9a7cd76abc4ac423d9141bded2.zip |
Adding fallback support for pyyaml.
Diffstat (limited to 'roles/lib_openshift/src')
-rwxr-xr-x | roles/lib_openshift/src/test/unit/oc_route.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/roles/lib_openshift/src/test/unit/oc_route.py b/roles/lib_openshift/src/test/unit/oc_route.py index fcfa88cbf..361b61f4b 100755 --- a/roles/lib_openshift/src/test/unit/oc_route.py +++ b/roles/lib_openshift/src/test/unit/oc_route.py @@ -35,8 +35,9 @@ class OCRouteTest(unittest.TestCase): ''' setup method will create a file and set to known configuration ''' pass + @mock.patch('oc_route.Utils.create_tmpfile_copy') @mock.patch('oc_route.OCRoute._run') - def test_list_route(self, mock_cmd): + def test_list_route(self, mock_cmd, mock_tmpfile_copy): ''' Testing getting a route ''' # Arrange @@ -114,6 +115,10 @@ class OCRouteTest(unittest.TestCase): (0, route_result, ''), ] + mock_tmpfile_copy.side_effect = [ + '/tmp/mock.kubeconfig', + ] + # Act results = OCRoute.run_ansible(params, False) @@ -127,11 +132,11 @@ class OCRouteTest(unittest.TestCase): mock.call(['oc', '-n', 'default', 'get', 'route', 'test', '-o', 'json'], None), ]) + @mock.patch('oc_route.Utils.create_tmpfile_copy') @mock.patch('oc_route.Yedit._write') @mock.patch('oc_route.OCRoute._run') - def test_create_route(self, mock_cmd, mock_write): + def test_create_route(self, mock_cmd, mock_write, mock_tmpfile_copy): ''' Testing getting a route ''' - # Arrange # run_ansible input parameters @@ -230,6 +235,10 @@ metadata: (0, route_result, ''), ] + mock_tmpfile_copy.side_effect = [ + '/tmp/mock.kubeconfig', + ] + mock_write.assert_has_calls = [ # First call to mock mock.call('/tmp/test', test_route) @@ -246,7 +255,8 @@ metadata: # Making sure our mock was called as we expected mock_cmd.assert_has_calls([ mock.call(['oc', '-n', 'default', 'get', 'route', 'test', '-o', 'json'], None), - mock.call(['oc', '-n', 'default', 'create', '-f', '/tmp/test'], None), + mock.call(['oc', '-n', 'default', 'create', '-f', mock.ANY], None), + mock.call(['oc', '-n', 'default', 'get', 'route', 'test', '-o', 'json'], None), ]) def tearDown(self): |