aboutsummaryrefslogtreecommitdiffstats
path: root/functest_kubernetes/test_k8stest.py
diff options
context:
space:
mode:
Diffstat (limited to 'functest_kubernetes/test_k8stest.py')
-rw-r--r--functest_kubernetes/test_k8stest.py22
1 files changed, 4 insertions, 18 deletions
diff --git a/functest_kubernetes/test_k8stest.py b/functest_kubernetes/test_k8stest.py
index a94fdf88..81d92853 100644
--- a/functest_kubernetes/test_k8stest.py
+++ b/functest_kubernetes/test_k8stest.py
@@ -49,29 +49,15 @@ class K8sTests(unittest.TestCase):
with self.assertRaises(TypeError):
self.k8stesting.run_kubetest()
- @mock.patch('functest_kubernetes.k8stest.os.path.isfile')
- def test_error_logging(self, mock_isfile):
- # pylint: disable=unused-argument
- with mock.patch('functest_kubernetes.k8stest.'
- 'subprocess.Popen') as mock_popen, \
- mock.patch.object(self.k8stesting,
- '_K8sTesting__logger') as mock_logger:
- mock_stdout = mock.Mock()
- attrs = {'stdout.read.return_value': 'Error loading client'}
- mock_stdout.configure_mock(**attrs)
- mock_popen.return_value = mock_stdout
- self.k8stesting.run()
- mock_logger.exception.assert_called_with(
- "Error with running kubetest:")
-
+ @mock.patch('re.search')
@mock.patch('six.moves.builtins.open', mock.mock_open())
@mock.patch('functest_kubernetes.k8stest.os.path.isfile')
@mock.patch('functest_kubernetes.k8stest.subprocess.Popen')
- def test_run(self, mock_open, mock_isfile):
+ def test_run(self, *args):
self.assertEquals(self.k8stesting.run(),
testcase.TestCase.EX_OK)
- mock_isfile.assert_called()
- mock_open.assert_called()
+ for loop in range(3):
+ args[loop].assert_called()
if __name__ == "__main__":