From: Ethan Lynn Date: Mon, 26 Mar 2018 05:07:30 +0000 (-0700) Subject: Add test_delete_dirs_success X-Git-Tag: v1.1.2~31^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=multicloud%2Fframework.git;a=commitdiff_plain;h=dcdca06c97e6b3c9b603b1e002384fb5122cf8ec Add test_delete_dirs_success Add test_delete_dirs_success for fileutil.py Change-Id: I8fb91a38889afcd4b1a3fd4ca86b67e73cae3379 Issue-ID: MULTICLOUD-198 Signed-off-by: Ethan Lynn --- diff --git a/multivimbroker/multivimbroker/tests/test_fileutil.py b/multivimbroker/multivimbroker/tests/test_fileutil.py index 9bc48a6..521c3b4 100644 --- a/multivimbroker/multivimbroker/tests/test_fileutil.py +++ b/multivimbroker/multivimbroker/tests/test_fileutil.py @@ -32,3 +32,11 @@ class TestFileutil(unittest.TestCase): mock_exists.return_value = False fileutil.make_dirs(new_path) mock_mkdir.assert_called_once_with(new_path, 0777) + + @mock.patch.object(os.path, "exists") + @mock.patch("shutil.rmtree") + def test_delete_dirs_success(self, mock_rmtree, mock_exists): + mock_exists.return_value = True + new_path = "/tmp/tests" + fileutil.delete_dirs(new_path) + mock_rmtree.assert_called_once_with(new_path)