diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-02-28 09:55:27 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-02-28 09:55:27 +0100 |
commit | d30a79ce464a596a29cb1385b88dd00ac42a2c61 (patch) | |
tree | 7209b9dd6e16be8cd2f2b1637e0e6a0e0f0ace35 /xtesting/tests | |
parent | 2aab5c48df64b044ab9bae6e883e6e0acaabbf52 (diff) |
Remove all OpenStack operations in vnf.py
Change-Id: I356305f3c59b51f97f5fb1335369834a77fda9b1
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/tests')
-rw-r--r-- | xtesting/tests/unit/core/test_vnf.py | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/xtesting/tests/unit/core/test_vnf.py b/xtesting/tests/unit/core/test_vnf.py index ec8a783e..34380a69 100644 --- a/xtesting/tests/unit/core/test_vnf.py +++ b/xtesting/tests/unit/core/test_vnf.py @@ -16,9 +16,6 @@ import mock from xtesting.core import vnf from xtesting.core import testcase -from xtesting.utils import constants - -from snaps.openstack.os_credentials import OSCreds class VnfBaseTesting(unittest.TestCase): @@ -107,45 +104,9 @@ class VnfBaseTesting(unittest.TestCase): return_value=True): self.assertEqual(self.test.run(), testcase.TestCase.EX_OK) - @mock.patch('xtesting.core.vnf.OpenStackUser') - @mock.patch('xtesting.core.vnf.OpenStackProject') - @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials', - side_effect=Exception) - def test_prepare_exc1(self, *args): - with self.assertRaises(Exception): - self.test.prepare() - args[0].assert_called_with(os_env_file=constants.ENV_FILE) - args[1].assert_not_called() - args[2].assert_not_called() - - @mock.patch('xtesting.core.vnf.OpenStackUser') - @mock.patch('xtesting.core.vnf.OpenStackProject', side_effect=Exception) - @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials') - def test_prepare_exc2(self, *args): - with self.assertRaises(Exception): - self.test.prepare() - args[0].assert_called_with(os_env_file=constants.ENV_FILE) - args[1].assert_called_with(mock.ANY, mock.ANY) - args[2].assert_not_called() - - @mock.patch('xtesting.core.vnf.OpenStackUser', side_effect=Exception) - @mock.patch('xtesting.core.vnf.OpenStackProject') - @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials') - def test_prepare_exc3(self, *args): - with self.assertRaises(Exception): + def test_prepare(self): + with self.assertRaises(vnf.VnfPreparationException): self.test.prepare() - args[0].assert_called_with(os_env_file=constants.ENV_FILE) - args[1].assert_called_with(mock.ANY, mock.ANY) - args[2].assert_called_with(mock.ANY, mock.ANY) - - @mock.patch('xtesting.core.vnf.OpenStackUser') - @mock.patch('xtesting.core.vnf.OpenStackProject') - @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials') - def test_prepare_default(self, *args): - self.assertEqual(self.test.prepare(), testcase.TestCase.EX_OK) - args[0].assert_called_with(os_env_file=constants.ENV_FILE) - args[1].assert_called_with(mock.ANY, mock.ANY) - args[2].assert_called_with(mock.ANY, mock.ANY) def test_deploy_vnf_unimplemented(self): with self.assertRaises(vnf.VnfDeploymentException): @@ -158,16 +119,6 @@ class VnfBaseTesting(unittest.TestCase): def test_deploy_orch_unimplemented(self): self.assertTrue(self.test.deploy_orchestrator()) - @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials', - return_value=OSCreds( - username='user', password='pass', - auth_url='http://foo.com:5000/v3', project_name='bar'), - side_effect=Exception) - def test_prepare_keystone_client_ko(self, *args): - with self.assertRaises(vnf.VnfPreparationException): - self.test.prepare() - args[0].assert_called_once() - def test_vnf_clean_exc(self): obj = mock.Mock() obj.clean.side_effect = Exception |