From: Ethan Lynn Date: Mon, 26 Mar 2018 05:03:50 +0000 (-0700) Subject: Add test_make_dirs_path_not_exists X-Git-Tag: v1.1.2~32^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=multicloud%2Fframework.git;a=commitdiff_plain;h=db20d587b47b1a24689b2afb6459f202b04ceb01 Add test_make_dirs_path_not_exists Add test_make_dirs_path_not_exists for fileutil.py Change-Id: I00bbbb40801c0be49676daa6c7589e0844a09e6e 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 8eb4a52..9bc48a6 100644 --- a/multivimbroker/multivimbroker/tests/test_fileutil.py +++ b/multivimbroker/multivimbroker/tests/test_fileutil.py @@ -24,3 +24,11 @@ class TestFileutil(unittest.TestCase): mock_exists.return_value = True fileutil.make_dirs(new_path) mock_mkdir.assert_not_called() + + @mock.patch.object(os.path, "exists") + @mock.patch("os.makedirs") + def test_make_dirs_path_not_exists(self, mock_mkdir, mock_exists): + new_path = "/tmp/test" + mock_exists.return_value = False + fileutil.make_dirs(new_path) + mock_mkdir.assert_called_once_with(new_path, 0777)