diff options
author | Konrad Djimeli <konraddjimeli@gmail.com> | 2018-04-09 05:43:23 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-04-10 11:18:11 +0200 |
commit | 7faf0ca91aeb24d31d1e3dd66674aedccebfc991 (patch) | |
tree | f884e3a7932a0578c5c9ce11690b238bc9932e43 /functest_kubernetes/test_k8stest.py | |
parent | 2594882b1dae9828eeac3eed976a73621adbe98f (diff) |
Add unit tests for K8sTesting's run and run_kubetest methods
Change-Id: I0442614c609d0d6248c1896d0bc8f55c32e5152d
Signed-off-by: Konrad Djimeli <konraddjimeli@gmail.com>
(cherry picked from commit a21472e084798165d15baedcb4624b8ea328e4ff)
Diffstat (limited to 'functest_kubernetes/test_k8stest.py')
-rw-r--r-- | functest_kubernetes/test_k8stest.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/functest_kubernetes/test_k8stest.py b/functest_kubernetes/test_k8stest.py index 230b6e0e..05f40e12 100644 --- a/functest_kubernetes/test_k8stest.py +++ b/functest_kubernetes/test_k8stest.py @@ -61,6 +61,19 @@ class K8sTests(unittest.TestCase): "Cannot run k8s testcases. Config file not found") mock_func.assert_called_with('not_file') + def test_run_kubetest_cmd_none(self): + self.k8stesting.cmd = None + with self.assertRaises(TypeError): + self.k8stesting.run_kubetest() + + @mock.patch('functest_kubernetes.k8stest.os.path.isfile') + @mock.patch('functest_kubernetes.k8stest.subprocess.Popen') + def test_run(self, mock_open, mock_isfile): + self.assertEquals(self.k8stesting.run(), + testcase.TestCase.EX_OK) + mock_isfile.assert_called() + mock_open.assert_called() + if __name__ == "__main__": logging.disable(logging.CRITICAL) |