aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests
diff options
context:
space:
mode:
Diffstat (limited to 'functest/tests')
-rw-r--r--functest/tests/unit/cli/commands/test_cli_env.py14
-rw-r--r--functest/tests/unit/core/test_unit.py12
-rw-r--r--functest/tests/unit/core/test_vnf.py263
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py27
-rw-r--r--functest/tests/unit/utils/test_openstack_utils.py71
-rw-r--r--functest/tests/unit/vnf/ims/test_cloudify_ims.py31
-rw-r--r--functest/tests/unit/vnf/ims/test_ims_base.py17
7 files changed, 236 insertions, 199 deletions
diff --git a/functest/tests/unit/cli/commands/test_cli_env.py b/functest/tests/unit/cli/commands/test_cli_env.py
index 14e926eb..b4e98787 100644
--- a/functest/tests/unit/cli/commands/test_cli_env.py
+++ b/functest/tests/unit/cli/commands/test_cli_env.py
@@ -8,7 +8,6 @@
import logging
import unittest
-from git.exc import NoSuchPathError
import mock
from functest.cli.commands import cli_env
@@ -72,42 +71,29 @@ class CliEnvTesting(unittest.TestCase):
mock_click_echo.assert_called_with(test_utils.
RegexMatch(reg_string))
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_installer_type(self, *args):
self._test_show_missing_env_var('INSTALLER_TYPE', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_installer_ip(self, *args):
self._test_show_missing_env_var('INSTALLER_IP', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_scenario(self, *args):
self._test_show_missing_env_var('SCENARIO', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_node(self, *args):
self._test_show_missing_env_var('NODE', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_build_tag(self, *args):
self._test_show_missing_env_var('BUILD_TAG', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
def test_show_missing_ci_debug(self, *args):
self._test_show_missing_env_var('DEBUG', *args)
- @mock.patch('functest.cli.commands.cli_env.git.Repo')
@mock.patch('functest.cli.commands.cli_env.os.path.isfile',
return_value=False)
def test_show_missing_environment(self, *args):
self._test_show_missing_env_var('STATUS', *args)
- @mock.patch('functest.cli.commands.cli_env.os.path.exists',
- return_value=False)
- def test_show_missing_git_repo_dir(self, *args):
- CONST.__setattr__('dir_repo_functest', None)
- self.assertRaises(NoSuchPathError, lambda: self.cli_environ.show())
-
@mock.patch('functest.cli.commands.cli_env.click.echo')
@mock.patch('functest.cli.commands.cli_env.os.path.isfile',
return_value=True)
diff --git a/functest/tests/unit/core/test_unit.py b/functest/tests/unit/core/test_unit.py
index 79c4e7d7..ca73de67 100644
--- a/functest/tests/unit/core/test_unit.py
+++ b/functest/tests/unit/core/test_unit.py
@@ -41,7 +41,9 @@ class PyTestSuiteRunnerTesting(unittest.TestCase):
self._test_run(result=mock_result,
status=testcase.TestCase.EX_RUN_ERROR)
self.assertEqual(self.psrunner.result, 0)
- self.assertEqual(self.psrunner.details, {'errors': [], 'failures': []})
+ self.assertEqual(self.psrunner.details,
+ {'errors': 0, 'failures': 0, 'stream': '',
+ 'testsRun': 0})
self.assertEqual(self.psrunner.is_successful(),
testcase.TestCase.EX_TESTCASE_FAILED)
@@ -52,8 +54,8 @@ class PyTestSuiteRunnerTesting(unittest.TestCase):
self._test_run(result=mock_result)
self.assertEqual(self.psrunner.result, 96)
self.assertEqual(self.psrunner.details,
- {'errors': [('test1', 'error_msg1')],
- 'failures': [('test2', 'failure_msg1')]})
+ {'errors': 1, 'failures': 1, 'stream': '',
+ 'testsRun': 50})
self.assertEqual(self.psrunner.is_successful(),
testcase.TestCase.EX_TESTCASE_FAILED)
@@ -62,7 +64,9 @@ class PyTestSuiteRunnerTesting(unittest.TestCase):
failures=[])
self._test_run(result=mock_result)
self.assertEqual(self.psrunner.result, 100)
- self.assertEqual(self.psrunner.details, {'errors': [], 'failures': []})
+ self.assertEqual(self.psrunner.details,
+ {'errors': 0, 'failures': 0, 'stream': '',
+ 'testsRun': 50})
self.assertEqual(self.psrunner.is_successful(),
testcase.TestCase.EX_OK)
diff --git a/functest/tests/unit/core/test_vnf.py b/functest/tests/unit/core/test_vnf.py
index ce859040..f061c409 100644
--- a/functest/tests/unit/core/test_vnf.py
+++ b/functest/tests/unit/core/test_vnf.py
@@ -10,156 +10,199 @@
# pylint: disable=missing-docstring
import logging
-import os
import unittest
import mock
from functest.core import vnf
from functest.core import testcase
+from functest.utils import constants
class VnfBaseTesting(unittest.TestCase):
+ """The class testing VNF."""
+ # pylint: disable=missing-docstring,too-many-public-methods
+
+ tenant_name = 'test_tenant_name'
+ tenant_description = 'description'
def setUp(self):
- self.test = vnf.VnfOnBoarding(
- project='functest', case_name='aaa')
- self.test.project = "functest"
- self.test.start_time = "1"
- self.test.stop_time = "5"
- self.test.result = ""
- self.test.details = {
- "orchestrator": {"status": "PASS", "result": "", "duration": 20},
- "vnf": {"status": "PASS", "result": "", "duration": 15},
- "test_vnf": {"status": "FAIL", "result": "", "duration": 5}}
- self.test.keystone_client = 'test_client'
- self.test.tenant_name = 'test_tenant_name'
-
- def test_execute_deploy_vnf_fail(self):
+ constants.CONST.__setattr__("vnf_foo_tenant_name", self.tenant_name)
+ constants.CONST.__setattr__(
+ "vnf_foo_tenant_description", self.tenant_description)
+ self.test = vnf.VnfOnBoarding(project='functest', case_name='foo')
+
+ def test_run_deploy_vnf_exc(self):
with mock.patch.object(self.test, 'prepare'),\
mock.patch.object(self.test, 'deploy_orchestrator',
return_value=None), \
mock.patch.object(self.test, 'deploy_vnf',
side_effect=Exception):
- self.assertEqual(self.test.execute(),
+ self.assertEqual(self.test.run(),
testcase.TestCase.EX_TESTCASE_FAILED)
- def test_execute_test_vnf_fail(self):
+ def test_run_test_vnf_exc(self):
with mock.patch.object(self.test, 'prepare'),\
mock.patch.object(self.test, 'deploy_orchestrator',
return_value=None), \
mock.patch.object(self.test, 'deploy_vnf'), \
mock.patch.object(self.test, 'test_vnf',
side_effect=Exception):
- self.assertEqual(self.test.execute(),
+ self.assertEqual(self.test.run(),
testcase.TestCase.EX_TESTCASE_FAILED)
- @mock.patch('functest.core.vnf.os_utils.get_tenant_id',
- return_value='test_tenant_id')
- @mock.patch('functest.core.vnf.os_utils.delete_tenant',
- return_value=True)
- @mock.patch('functest.core.vnf.os_utils.get_user_id',
- return_value='test_user_id')
- @mock.patch('functest.core.vnf.os_utils.delete_user',
- return_value=True)
- def test_execute_default(self, *args):
+ def test_run_deploy_orch_ko(self):
with mock.patch.object(self.test, 'prepare'),\
mock.patch.object(self.test, 'deploy_orchestrator',
- return_value=None), \
- mock.patch.object(self.test, 'deploy_vnf'), \
- mock.patch.object(self.test, 'test_vnf'), \
- mock.patch.object(self.test, 'parse_results',
- return_value='ret_exit_code'), \
- mock.patch.object(self.test, 'log_results'):
- self.assertEqual(self.test.execute(),
- 'ret_exit_code')
-
- @mock.patch('functest.core.vnf.os_utils.get_credentials')
+ return_value=False), \
+ mock.patch.object(self.test, 'deploy_vnf',
+ return_value=True), \
+ mock.patch.object(self.test, 'test_vnf',
+ return_value=True):
+ self.assertEqual(self.test.run(),
+ testcase.TestCase.EX_TESTCASE_FAILED)
+
+ def test_run_vnf_deploy_ko(self):
+ with mock.patch.object(self.test, 'prepare'),\
+ mock.patch.object(self.test, 'deploy_orchestrator',
+ return_value=True), \
+ mock.patch.object(self.test, 'deploy_vnf',
+ return_value=False), \
+ mock.patch.object(self.test, 'test_vnf',
+ return_value=True):
+ self.assertEqual(self.test.run(),
+ testcase.TestCase.EX_TESTCASE_FAILED)
+
+ def test_run_vnf_test_ko(self):
+ with mock.patch.object(self.test, 'prepare'),\
+ mock.patch.object(self.test, 'deploy_orchestrator',
+ return_value=True), \
+ mock.patch.object(self.test, 'deploy_vnf',
+ return_value=True), \
+ mock.patch.object(self.test, 'test_vnf',
+ return_value=False):
+ self.assertEqual(self.test.run(),
+ testcase.TestCase.EX_TESTCASE_FAILED)
+
+ def test_run_default(self):
+ with mock.patch.object(self.test, 'prepare'),\
+ mock.patch.object(self.test, 'deploy_orchestrator',
+ return_value=True), \
+ mock.patch.object(self.test, 'deploy_vnf',
+ return_value=True), \
+ mock.patch.object(self.test, 'test_vnf',
+ return_value=True):
+ self.assertEqual(self.test.run(), testcase.TestCase.EX_OK)
+
+ def test_deploy_vnf_unimplemented(self):
+ with self.assertRaises(vnf.VnfDeploymentException):
+ self.test.deploy_vnf()
+
+ def test_test_vnf_unimplemented(self):
+ with self.assertRaises(vnf.VnfTestException):
+ self.test.test_vnf()
+
@mock.patch('functest.core.vnf.os_utils.get_keystone_client')
- @mock.patch('functest.core.vnf.os_utils.get_user_id', return_value='')
- def test_prepare_missing_userid(self, *args):
- with self.assertRaises(Exception):
- self.test.prepare()
+ @mock.patch('functest.core.vnf.os_utils.delete_user',
+ return_value=True)
+ def test_clean_user_set(self, *args):
+ self.test.user_created = True
+ self.test.clean()
+ args[0].assert_called_once_with(mock.ANY, self.tenant_name)
+ args[1].assert_called_once_with()
- @mock.patch('functest.core.vnf.os_utils.get_credentials')
@mock.patch('functest.core.vnf.os_utils.get_keystone_client')
- @mock.patch('functest.core.vnf.os_utils.get_user_id',
- return_value='test_roleid')
- @mock.patch('functest.core.vnf.os_utils.create_tenant',
- return_value='')
- def test_prepare_missing_tenantid(self, *args):
- with self.assertRaises(Exception):
- self.test.prepare()
+ @mock.patch('functest.core.vnf.os_utils.delete_user',
+ return_value=True)
+ def test_clean_user_unset(self, *args):
+ self.test.user_created = False
+ self.test.clean()
+ args[0].assert_not_called()
+ args[1].assert_called_once_with()
- @mock.patch('functest.core.vnf.os_utils.get_credentials')
@mock.patch('functest.core.vnf.os_utils.get_keystone_client')
- @mock.patch('functest.core.vnf.os_utils.get_user_id',
- return_value='test_roleid')
- @mock.patch('functest.core.vnf.os_utils.create_tenant',
- return_value='test_tenantid')
- @mock.patch('functest.core.vnf.os_utils.get_role_id',
- return_value='')
- def test_prepare_missing_roleid(self, *args):
- with self.assertRaises(Exception):
- self.test.prepare()
+ @mock.patch('functest.core.vnf.os_utils.delete_tenant',
+ return_value=True)
+ def test_clean_tenant_set(self, *args):
+ self.test.tenant_created = True
+ self.test.clean()
+ args[0].assert_called_once_with(mock.ANY, self.tenant_name)
+ args[1].assert_called_once_with()
- @mock.patch('functest.core.vnf.os_utils.get_credentials')
@mock.patch('functest.core.vnf.os_utils.get_keystone_client')
- @mock.patch('functest.core.vnf.os_utils.get_user_id',
- return_value='test_roleid')
- @mock.patch('functest.core.vnf.os_utils.create_tenant',
- return_value='test_tenantid')
- @mock.patch('functest.core.vnf.os_utils.get_role_id',
- return_value='test_roleid')
- @mock.patch('functest.core.vnf.os_utils.add_role_user',
- return_value='')
- def test_prepare_role_add_failure(self, *args):
- with self.assertRaises(Exception):
+ @mock.patch('functest.core.vnf.os_utils.delete_tenant',
+ return_value=True)
+ def test_clean_tenant_unset(self, *args):
+ self.test.tenant_created = False
+ self.test.clean()
+ args[0].assert_not_called()
+ args[1].assert_called_once_with()
+
+ def test_deploy_orch_unimplemented(self):
+ self.assertTrue(self.test.deploy_orchestrator())
+
+ @mock.patch('functest.core.vnf.os_utils.get_credentials',
+ return_value={'creds': 'test'})
+ @mock.patch('functest.core.vnf.os_utils.get_keystone_client',
+ return_value='test')
+ @mock.patch('functest.core.vnf.os_utils.get_or_create_tenant_for_vnf',
+ return_value=0)
+ @mock.patch('functest.core.vnf.os_utils.get_or_create_user_for_vnf',
+ return_value=0)
+ def test_prepare(self, *args):
+ self.assertEqual(self.test.prepare(),
+ testcase.TestCase.EX_OK)
+ args[0].assert_called_once_with('test', self.tenant_name)
+ args[1].assert_called_once_with(
+ 'test', self.tenant_name, self.tenant_description)
+ args[2].assert_called_once_with()
+ args[3].assert_called_once_with()
+
+ @mock.patch('functest.core.vnf.os_utils.get_credentials',
+ side_effect=Exception)
+ def test_prepare_admin_creds_ko(self, *args):
+ with self.assertRaises(vnf.VnfPreparationException):
self.test.prepare()
+ args[0].assert_called_once_with()
+
+ @mock.patch('functest.core.vnf.os_utils.get_credentials',
+ return_value='creds')
+ @mock.patch('functest.core.vnf.os_utils.get_keystone_client',
+ side_effect=Exception)
+ def test_prepare_keystone_client_ko(self, *args):
+ with self.assertRaises(vnf.VnfPreparationException):
+ self.test.prepare()
+ args[0].assert_called_once_with()
+ args[1].assert_called_once_with()
- @mock.patch('functest.core.vnf.os_utils.get_credentials')
+ @mock.patch('functest.core.vnf.os_utils.get_credentials',
+ return_value='creds')
@mock.patch('functest.core.vnf.os_utils.get_keystone_client')
- @mock.patch('functest.core.vnf.os_utils.get_user_id',
- return_value='test_roleid')
- @mock.patch('functest.core.vnf.os_utils.create_tenant',
- return_value='test_tenantid')
- @mock.patch('functest.core.vnf.os_utils.get_role_id',
- return_value='test_roleid')
- @mock.patch('functest.core.vnf.os_utils.add_role_user')
- @mock.patch('functest.core.vnf.os_utils.create_user',
- return_value='')
- def test_create_user_failure(self, *args):
- with self.assertRaises(Exception):
+ @mock.patch('functest.core.vnf.os_utils.get_or_create_tenant_for_vnf',
+ side_effect=Exception)
+ def test_prepare_tenant_creation_ko(self, *args):
+ with self.assertRaises(vnf.VnfPreparationException):
self.test.prepare()
+ args[0].assert_called_once_with(
+ mock.ANY, self.tenant_name, self.tenant_description)
+ args[1].assert_called_once_with()
+ args[2].assert_called_once_with()
- def test_log_results_default(self):
- with mock.patch('functest.core.vnf.'
- 'ft_utils.logger_test_results') \
- as mock_method:
- self.test.log_results()
- self.assertTrue(mock_method.called)
-
- def test_step_failures_default(self):
- with self.assertRaises(Exception):
- self.test.step_failure("error_msg")
-
- def test_deploy_vnf_unimplemented(self):
- with self.assertRaises(Exception) as context:
- self.test.deploy_vnf()
- self.assertIn('VNF not deployed', str(context.exception))
-
- def test_test_vnf_unimplemented(self):
- with self.assertRaises(Exception) as context:
- self.test.test_vnf()()
- self.assertIn('VNF not tested', str(context.exception))
-
- def test_parse_results_ex_ok(self):
- self.test.details['test_vnf']['status'] = 'PASS'
- self.assertEqual(self.test.parse_results(), os.EX_OK)
-
- def test_parse_results_ex_run_error(self):
- self.test.details['vnf']['status'] = 'FAIL'
- self.assertEqual(self.test.parse_results(), os.EX_SOFTWARE)
+ @mock.patch('functest.core.vnf.os_utils.get_credentials',
+ return_value='creds')
+ @mock.patch('functest.core.vnf.os_utils.get_keystone_client')
+ @mock.patch('functest.core.vnf.os_utils.get_or_create_tenant_for_vnf',
+ return_value=0)
+ @mock.patch('functest.core.vnf.os_utils.get_or_create_user_for_vnf',
+ side_effect=Exception)
+ def test_prepare_user_creation_ko(self, *args):
+ with self.assertRaises(vnf.VnfPreparationException):
+ self.test.prepare()
+ args[0].assert_called_once_with(mock.ANY, self.tenant_name)
+ args[1].assert_called_once_with(
+ mock.ANY, self.tenant_name, self.tenant_description)
+ args[2].assert_called_once_with()
+ args[3].assert_called_once_with()
if __name__ == "__main__":
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py
index d84a3201..fbfa420a 100644
--- a/functest/tests/unit/utils/test_functest_utils.py
+++ b/functest/tests/unit/utils/test_functest_utils.py
@@ -8,11 +8,11 @@
# http://www.apache.org/licenses/LICENSE-2.0
import logging
+import pkg_resources
import os
import time
import unittest
-from git.exc import NoSuchPathError
import mock
import requests
from six.moves import urllib
@@ -56,8 +56,8 @@ class FunctestUtilsTesting(unittest.TestCase):
self.testcase_dict = {'case_name': 'testname',
'criteria': self.criteria}
self.parameter = 'general.openstack.image_name'
- self.config_yaml = os.path.normpath(os.path.join(os.path.dirname(
- os.path.abspath(__file__)), '../../../ci/config_functest.yaml'))
+ self.config_yaml = pkg_resources.resource_filename(
+ 'functest', 'ci/config_functest.yaml')
self.db_url_env = 'http://foo/testdb'
self.testcases_yaml = "test_testcases_yaml"
self.file_yaml = {'general': {'openstack': {'image_name':
@@ -97,27 +97,6 @@ class FunctestUtilsTesting(unittest.TestCase):
m.assert_called_once_with(dest, 'wb')
self.assertTrue(mock_sh.called)
- def test_get_git_branch(self):
- with mock.patch('functest.utils.functest_utils.Repo') as mock_repo:
- mock_obj2 = mock.Mock()
- attrs = {'name': 'test_branch'}
- mock_obj2.configure_mock(**attrs)
-
- mock_obj = mock.Mock()
- attrs = {'active_branch': mock_obj2}
- mock_obj.configure_mock(**attrs)
-
- mock_repo.return_value = mock_obj
- self.assertEqual(functest_utils.get_git_branch(self.repo_path),
- 'test_branch')
-
- @mock.patch('functest.utils.functest_utils.Repo',
- side_effect=NoSuchPathError)
- def test_get_git_branch_failed(self, mock_repo):
- self.assertRaises(NoSuchPathError,
- lambda: functest_utils.get_git_branch(self.repo_path
- ))
-
@mock.patch('functest.utils.functest_utils.logger.error')
def test_get_installer_type_failed(self, mock_logger_error):
with mock.patch.dict(os.environ,
diff --git a/functest/tests/unit/utils/test_openstack_utils.py b/functest/tests/unit/utils/test_openstack_utils.py
index 15b54057..0f06b1e1 100644
--- a/functest/tests/unit/utils/test_openstack_utils.py
+++ b/functest/tests/unit/utils/test_openstack_utils.py
@@ -1835,6 +1835,77 @@ class OSUtilsTesting(unittest.TestCase):
None)
self.assertTrue(mock_logger_error.called)
+ def test_get_or_create_user_for_vnf_get(self):
+ with mock.patch('functest.utils.openstack_utils.'
+ 'get_user_id',
+ return_value='user_id'), \
+ mock.patch('functest.utils.openstack_utils.get_tenant_id',
+ return_value='tenant_id'):
+ self.assertFalse(openstack_utils.
+ get_or_create_user_for_vnf(self.keystone_client,
+ 'my_vnf'))
+
+ def test_get_or_create_user_for_vnf_create(self):
+ with mock.patch('functest.utils.openstack_utils.'
+ 'get_user_id',
+ return_value=None), \
+ mock.patch('functest.utils.openstack_utils.get_tenant_id',
+ return_value='tenant_id'):
+ self.assertTrue(openstack_utils.
+ get_or_create_user_for_vnf(self.keystone_client,
+ 'my_vnf'))
+
+ def test_get_or_create_user_for_vnf_error_get_user_id(self):
+ with mock.patch('functest.utils.openstack_utils.'
+ 'get_user_id',
+ side_effect=Exception):
+ self.assertRaises(Exception)
+
+ def test_get_or_create_user_for_vnf_error_get_tenant_id(self):
+ with mock.patch('functest.utils.openstack_utils.'
+ 'get_user_id',
+ return_value='user_id'), \
+ mock.patch('functest.utils.openstack_utils.get_tenant_id',
+ side_effect='Exception'):
+ self.assertRaises(Exception)
+
+ def test_get_or_create_tenant_for_vnf_get(self):
+ with mock.patch('functest.utils.openstack_utils.'
+ 'get_tenant_id',
+ return_value='tenant_id'):
+ self.assertFalse(
+ openstack_utils.get_or_create_tenant_for_vnf(
+ self.keystone_client, 'tenant_name', 'tenant_description'))
+
+ def test_get_or_create_tenant_for_vnf_create(self):
+ with mock.patch('functest.utils.openstack_utils.get_tenant_id',
+ return_value=None):
+ self.assertTrue(
+ openstack_utils.get_or_create_tenant_for_vnf(
+ self.keystone_client, 'tenant_name', 'tenant_description'))
+
+ def test_get_or_create_tenant_for_vnf_error_get_tenant_id(self):
+ with mock.patch('functest.utils.openstack_utils.'
+ 'get_tenant_id',
+ side_effect=Exception):
+ self.assertRaises(Exception)
+
+ def test_download_and_add_image_on_glance_image_creation_failure(self):
+ with mock.patch('functest.utils.openstack_utils.'
+ 'os.makedirs'), \
+ mock.patch('functest.utils.openstack_utils.'
+ 'ft_utils.download_url',
+ return_value=True), \
+ mock.patch('functest.utils.openstack_utils.'
+ 'create_glance_image',
+ return_value=''):
+ resp = openstack_utils.download_and_add_image_on_glance(
+ self.glance_client,
+ 'image_name',
+ 'http://url',
+ 'data_dir')
+ self.assertEqual(resp, False)
+
if __name__ == "__main__":
logging.disable(logging.CRITICAL)
diff --git a/functest/tests/unit/vnf/ims/test_cloudify_ims.py b/functest/tests/unit/vnf/ims/test_cloudify_ims.py
index c3c04e1d..2156a122 100644
--- a/functest/tests/unit/vnf/ims/test_cloudify_ims.py
+++ b/functest/tests/unit/vnf/ims/test_cloudify_ims.py
@@ -69,7 +69,7 @@ class CloudifyImsTesting(unittest.TestCase):
mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
'os_utils.get_image_id',
return_value=''), \
- mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
+ mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.os_utils.'
'download_and_add_image_on_glance') as m, \
self.assertRaises(Exception) as context:
self.ims_vnf.deploy_orchestrator()
@@ -458,35 +458,6 @@ class CloudifyImsTesting(unittest.TestCase):
{'status': 'PASS',
'result': 'vims_test_result'})
- def test_download_and_add_image_on_glance_incorrect_url(self):
- with mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
- 'os.makedirs'), \
- mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
- 'ft_utils.download_url',
- return_value=False):
- resp = cloudify_ims.download_and_add_image_on_glance(self.
- glance_client,
- 'image_name',
- 'http://url',
- 'data_dir')
- self.assertEqual(resp, False)
-
- def test_download_and_add_image_on_glance_image_creation_failure(self):
- with mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
- 'os.makedirs'), \
- mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
- 'ft_utils.download_url',
- return_value=True), \
- mock.patch('functest.opnfv_tests.vnf.ims.cloudify_ims.'
- 'os_utils.create_glance_image',
- return_value=''):
- resp = cloudify_ims.download_and_add_image_on_glance(self.
- glance_client,
- 'image_name',
- 'http://url',
- 'data_dir')
- self.assertEqual(resp, False)
-
if __name__ == "__main__":
logging.disable(logging.CRITICAL)
diff --git a/functest/tests/unit/vnf/ims/test_ims_base.py b/functest/tests/unit/vnf/ims/test_ims_base.py
index db5b18d7..66d35e39 100644
--- a/functest/tests/unit/vnf/ims/test_ims_base.py
+++ b/functest/tests/unit/vnf/ims/test_ims_base.py
@@ -35,23 +35,6 @@ class ClearwaterOnBoardingBaseTesting(unittest.TestCase):
'cookies': ""}
self.mock_post_200.configure_mock(**attrs)
- def test_create_ellis_number_failure(self):
- with mock.patch('functest.opnfv_tests.vnf.ims.'
- 'clearwater_ims_base.requests.post',
- return_value=self.mock_post_500), \
- self.assertRaises(Exception) as context:
- self.ims_vnf.create_ellis_number()
-
- msg = "Unable to create a number:"
- self.assertTrue(msg in context.exception)
-
- def _get_post_status(self, url, cookies='', data=''):
- ellis_url = "http://test_ellis_ip/session"
- if url == ellis_url:
- return self.mock_post_200
- return self.mock_post
-
-
if __name__ == "__main__":
logging.disable(logging.CRITICAL)
unittest.main(verbosity=2)