os.path.exists should be mocked in test case

This commit mocks os.path.exists in the test case
test_start_iscsi_target_fail_wait_daemon in
extensions.iscsi.TestISCSIExtension.  If this isn't
mocked, the file can coincidentally exist on the
environment and can cause failure.

Change-Id: Ibaa8fcae51faaaefc2764411d02621f347d99c03
This commit is contained in:
Ramakrishnan G
2015-03-11 17:16:07 +00:00
parent 8173927dd3
commit d1b30a14d2

View File

@@ -16,6 +16,7 @@
# under the License.
import mock
import os
import time
from oslo_concurrency import processutils
@@ -64,6 +65,7 @@ class TestISCSIExtension(test_base.BaseTestCase):
self.assertEqual({'iscsi_target_iqn': self.fake_iqn},
result.command_result)
@mock.patch.object(os.path, 'exists', lambda x: False)
def test_start_iscsi_target_fail_wait_daemon(self, mock_execute,
mock_dispatch):
mock_dispatch.return_value = self.fake_dev