Code Review
/
multicloud
/
framework.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
review
|
tree
raw
(from parent 1:
b4eee07
)
Merge "Add test_delete_dirs_failed"
author
Liang Ke
<lokyse@163.com>
Tue, 27 Mar 2018 02:25:20 +0000
(
02:25
+0000)
committer
Gerrit Code Review
<gerrit@onap.org>
Tue, 27 Mar 2018 02:25:20 +0000
(
02:25
+0000)
multivimbroker/multivimbroker/tests/test_fileutil.py
patch
|
blob
|
history
diff --git
a/multivimbroker/multivimbroker/tests/test_fileutil.py
b/multivimbroker/multivimbroker/tests/test_fileutil.py
index
521c3b4
..
9abd23c
100644
(file)
--- a/
multivimbroker/multivimbroker/tests/test_fileutil.py
+++ b/
multivimbroker/multivimbroker/tests/test_fileutil.py
@@
-40,3
+40,12
@@
class TestFileutil(unittest.TestCase):
new_path = "/tmp/tests"
fileutil.delete_dirs(new_path)
mock_rmtree.assert_called_once_with(new_path)
+
+ @mock.patch.object(os.path, "exists")
+ @mock.patch("shutil.rmtree")
+ def test_delete_dirs_failed(self, mock_rmtree, mock_exists):
+ mock_exists.return_value = True
+ mock_rmtree.side_effect = [Exception("Fake exception")]
+ new_path = "/tmp/tests"
+ fileutil.delete_dirs(new_path)
+ mock_rmtree.assert_called_once_with(new_path)