summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/test/unit/oc_serviceaccount_secret.py
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2017-02-08 12:19:45 -0500
committerGitHub <noreply@github.com>2017-02-08 12:19:45 -0500
commitbf1b4def44894ddc71d35e28c48c56078f90b947 (patch)
treeaf513224a29ed2d6d0e7f73a22428dec65258997 /roles/lib_openshift/src/test/unit/oc_serviceaccount_secret.py
parentb1565e9e843e99c6b3c0d99518c27249472f57fe (diff)
parent04ea66c4ab6cd1e5daa217526d7c9591aa164f10 (diff)
downloadopenshift-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_serviceaccount_secret.py')
-rwxr-xr-xroles/lib_openshift/src/test/unit/oc_serviceaccount_secret.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/roles/lib_openshift/src/test/unit/oc_serviceaccount_secret.py b/roles/lib_openshift/src/test/unit/oc_serviceaccount_secret.py
index 08fc9f6df..4d555d412 100755
--- a/roles/lib_openshift/src/test/unit/oc_serviceaccount_secret.py
+++ b/roles/lib_openshift/src/test/unit/oc_serviceaccount_secret.py
@@ -35,9 +35,10 @@ class OCServiceAccountSecretTest(unittest.TestCase):
''' setup method will create a file and set to known configuration '''
pass
+ @mock.patch('oc_serviceaccount_secret.Utils.create_tmpfile_copy')
@mock.patch('oc_serviceaccount_secret.Yedit._write')
@mock.patch('oc_serviceaccount_secret.OCServiceAccountSecret._run')
- def test_adding_a_secret_to_a_serviceaccount(self, mock_cmd, mock_write):
+ def test_adding_a_secret_to_a_serviceaccount(self, mock_cmd, mock_write, mock_tmpfile_copy):
''' Testing adding a secret to a service account '''
# Arrange
@@ -137,6 +138,10 @@ metadata:
(0, oc_get_sa_after, ''), # Fourth call to the mock
]
+ mock_tmpfile_copy.side_effect = [
+ '/tmp/mocked_kubeconfig',
+ ]
+
# Act
results = OCServiceAccountSecret.run_ansible(params, False)
@@ -157,9 +162,10 @@ metadata:
mock.call(mock.ANY, builder_yaml_file)
])
+ @mock.patch('oc_serviceaccount_secret.Utils.create_tmpfile_copy')
@mock.patch('oc_serviceaccount_secret.Yedit._write')
@mock.patch('oc_serviceaccount_secret.OCServiceAccountSecret._run')
- def test_removing_a_secret_to_a_serviceaccount(self, mock_cmd, mock_write):
+ def test_removing_a_secret_to_a_serviceaccount(self, mock_cmd, mock_write, mock_tmpfile_copy):
''' Testing removing a secret to a service account '''
# Arrange
@@ -229,6 +235,10 @@ metadata:
(0, 'serviceaccount "builder" replaced', ''), # Third call to the mock
]
+ mock_tmpfile_copy.side_effect = [
+ '/tmp/mocked_kubeconfig',
+ ]
+
# Act
results = OCServiceAccountSecret.run_ansible(params, False)