diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-11-29 19:33:07 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-11-30 06:00:56 +0100 |
commit | 69832cbd376f033b1b6af0ee6db417dc43b3037d (patch) | |
tree | 483d32e1530c6ddc82c3b2d910cb7ab6d95852e6 /functest/tests/unit/odl/test_odl.py | |
parent | 06ab9f1aaed50a5c78f3ed10f56cac8cdb2c75c7 (diff) |
Skip modifying creds if Variables.robot is missing
Variable.robot is missing in functest-features [1].
As it's related to ODL csit suites, modifying it could be safely
skipped as odl.py is designed for testing multiple ODL testcases.
[1] https://gerrit.opnfv.org/gerrit/#/c/46225/
Change-Id: Id5f1947a073d251ef7480f418218a4c85fe078c1
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/odl/test_odl.py')
-rw-r--r-- | functest/tests/unit/odl/test_odl.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index ff25cd7a..1a3f7950 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -154,7 +154,7 @@ class ODLMainTesting(ODLTesting): kwargs = self._get_run_suites_kwargs() self.assertEqual(self.test.run_suites(**kwargs), status) if len(args) > 0: - args[0].assert_called_once_with(self.test.res_dir) + args[0].assert_called_once_with(self.test.odl_variables_file) if len(args) > 1: variable = [ 'KEYSTONEURL:{}://{}'.format( @@ -214,15 +214,17 @@ class ODLMainTesting(ODLTesting): def test_no_odlrestconfport(self): self._test_no_keyword('odlrestconfport') - def test_set_vars_ko(self): + @mock.patch('os.path.isfile', return_value=True) + def test_set_vars_ko(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=False) as mock_object: self._test_run_suites(testcase.TestCase.EX_RUN_ERROR) mock_object.assert_called_once_with( self._odl_username, self._odl_password) + args[0].assert_called_once_with(self.test.odl_variables_file) @mock.patch('robot.run', side_effect=RobotError) - @mock.patch('os.makedirs') + @mock.patch('os.path.isfile', return_value=True) def test_run_ko(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ @@ -230,7 +232,7 @@ class ODLMainTesting(ODLTesting): self._test_run_suites(testcase.TestCase.EX_RUN_ERROR, *args) @mock.patch('robot.run') - @mock.patch('os.makedirs') + @mock.patch('os.path.isfile', return_value=True) def test_parse_results_ko(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ @@ -239,15 +241,24 @@ class ODLMainTesting(ODLTesting): self._test_run_suites(testcase.TestCase.EX_RUN_ERROR, *args) @mock.patch('robot.run') - @mock.patch('os.makedirs') + @mock.patch('os.path.isfile', return_value=True) def test_ok(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_run_suites(testcase.TestCase.EX_OK, *args) + @mock.patch('robot.run') + @mock.patch('os.path.isfile', return_value=False) + def test_ok_no_creds(self, *args): + with mock.patch.object(self.test, 'set_robotframework_vars', + return_value=True) as mock_method, \ + mock.patch.object(self.test, 'parse_results'): + self._test_run_suites(testcase.TestCase.EX_OK, *args) + mock_method.assert_not_called() + @mock.patch('robot.run', return_value=1) - @mock.patch('os.makedirs') + @mock.patch('os.path.isfile', return_value=True) def test_testcases_in_failure(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ |