Fix test for netenv validate
Previously we were actually attempting to open a file in the NIC_validate function when executed by this test because it was not properly mocked. If you had an empty file /tmp/foo, the test would fail because it would try and read data from it. Change-Id: Iab778b756637ae3e3a4beeea66bfa41b3cedd7b8 Closes-Bug: #1768337
This commit is contained in:
parent
569b59e48c
commit
24d6301d92
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
@ -257,7 +258,9 @@ class TestValidateOvercloudNetenv(fakes.TestValidateOvercloudNetenv):
|
||||
os.unlink(tmp)
|
||||
self.assertEqual(1, self.cmd.error_count)
|
||||
|
||||
def test_command(self):
|
||||
@mock.patch('tripleoclient.v1.overcloud_netenv_validate.'
|
||||
'ValidateOvercloudNetenv.NIC_validate', autospec=True)
|
||||
def test_command(self, mock_nic_validate):
|
||||
"""Testing the command with a minimal file that will fail"""
|
||||
with tempfile.NamedTemporaryFile('wt') as net_file:
|
||||
net_file.write(EMPTY_NETENV)
|
||||
|
Loading…
x
Reference in New Issue
Block a user