Properly mock unlink

I5de4d68cc2669d37e7a667209423b9ac842136ff added these tests but did not
properly mock the unlink that can be triggered. This change mocks the
os.unlink so it doesn't try to remove our mocked file when the tests
run.

Co-authored-by: Sergii Golovatiuk <sgolovat@redhat.com>

Change-Id: Ica28227b011255c23e677539c5e3df33f556e1b7
Closes-Bug: #1789506
This commit is contained in:
Alex Schultz 2018-08-28 16:54:33 -06:00 committed by Sergii Golovatiuk
parent 48719ad942
commit 6e6ad0a8ce
1 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,9 @@ from tripleoclient import utils
class TestRunAnsiblePlaybook(TestCase):
def setUp(self):
self.unlink_patch = mock.patch('os.unlink')
self.addCleanup(self.unlink_patch.stop)
self.unlink_patch.start()
self.mock_log = mock.Mock('logging.getLogger')
@mock.patch('os.path.exists', return_value=False)