Fix mocks in scenario_unit tests

In patch https://review.openstack.org/#/c/216396/ has been
fixed scenario tests, os.system -> subprocess.call, but in
unit-tests missing fix
Partial-bug: #1490544

Change-Id: I3fbea77700e6a48ff43cdf417d55c27b073f880d
This commit is contained in:
Evgeny Sikachev 2015-08-31 15:34:12 +03:00
parent 60b3362212
commit 2fff3aaded

View File

@ -216,22 +216,22 @@ class RunnerUnitTest(testtools.TestCase):
expected_cluster, config)) expected_cluster, config))
@mock.patch('sys.exit', return_value=None) @mock.patch('sys.exit', return_value=None)
@mock.patch('os.system', return_value=None) @mock.patch('subprocess.call', return_value=None)
def test_runner_main(self, mock_os, mock_sys): def test_runner_main(self, mock_sub, mock_sys):
sys.argv = ['sahara/tests/scenario/runner.py', sys.argv = ['sahara/tests/scenario/runner.py',
'sahara/tests/scenario_unit/vanilla2_7_1.yaml'] 'sahara/tests/scenario_unit/vanilla2_7_1.yaml']
runner.main() runner.main()
@mock.patch('sys.exit', return_value=None) @mock.patch('sys.exit', return_value=None)
@mock.patch('os.system', return_value=None) @mock.patch('subprocess.call', return_value=None)
def test_runner_template_missing_varfile(self, mock_os, mock_sys): def test_runner_template_missing_varfile(self, mock_sub, mock_sys):
sys.argv = ['sahara/tests/scenario/runner.py', sys.argv = ['sahara/tests/scenario/runner.py',
'sahara/tests/scenario_unit/vanilla2_7_1.yaml.mako'] 'sahara/tests/scenario_unit/vanilla2_7_1.yaml.mako']
self.assertRaises(NameError, runner.main) self.assertRaises(NameError, runner.main)
@mock.patch('sys.exit', return_value=None) @mock.patch('sys.exit', return_value=None)
@mock.patch('os.system', return_value=None) @mock.patch('subprocess.call', return_value=None)
def test_runner_template_wrong_varfile(self, mock_os, mock_sys): def test_runner_template_wrong_varfile(self, mock_sub, mock_sys):
sys.argv = ['sahara/tests/scenario/runner.py', sys.argv = ['sahara/tests/scenario/runner.py',
'-V', '-V',
'sahara/tests/scenario_unit/templatevars_nodefault.ini', 'sahara/tests/scenario_unit/templatevars_nodefault.ini',
@ -239,8 +239,8 @@ class RunnerUnitTest(testtools.TestCase):
self.assertRaises(NameError, runner.main) self.assertRaises(NameError, runner.main)
@mock.patch('sys.exit', return_value=None) @mock.patch('sys.exit', return_value=None)
@mock.patch('os.system', return_value=None) @mock.patch('subprocess.call', return_value=None)
def test_runner_template_incomplete_varfile(self, mock_os, mock_sys): def test_runner_template_incomplete_varfile(self, mock_sub, mock_sys):
sys.argv = ['sahara/tests/scenario/runner.py', sys.argv = ['sahara/tests/scenario/runner.py',
'-V', '-V',
'sahara/tests/scenario_unit/templatevars_incomplete.ini', 'sahara/tests/scenario_unit/templatevars_incomplete.ini',
@ -248,8 +248,8 @@ class RunnerUnitTest(testtools.TestCase):
self.assertRaises(NameError, runner.main) self.assertRaises(NameError, runner.main)
@mock.patch('sys.exit', return_value=None) @mock.patch('sys.exit', return_value=None)
@mock.patch('os.system', return_value=None) @mock.patch('subprocess.call', return_value=None)
def test_runner_template_working(self, mock_os, mock_sys): def test_runner_template_working(self, mock_sub, mock_sys):
sys.argv = ['sahara/tests/scenario/runner.py', sys.argv = ['sahara/tests/scenario/runner.py',
'-V', '-V',
'sahara/tests/scenario_unit/templatevars_complete.ini', 'sahara/tests/scenario_unit/templatevars_complete.ini',