diff options
Diffstat (limited to 'functest/tests')
-rw-r--r-- | functest/tests/unit/core/test_vnf_base.py | 52 | ||||
-rw-r--r-- | functest/tests/unit/odl/test_odl.py | 8 |
2 files changed, 57 insertions, 3 deletions
diff --git a/functest/tests/unit/core/test_vnf_base.py b/functest/tests/unit/core/test_vnf_base.py new file mode 100644 index 00000000..e27f2164 --- /dev/null +++ b/functest/tests/unit/core/test_vnf_base.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +# Copyright (c) 2016 Orange and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 + +import logging +import unittest + +from functest.core import vnf_base + + +class VnfBaseTesting(unittest.TestCase): + + logging.disable(logging.CRITICAL) + + def setUp(self): + self.test = vnf_base.VnfOnBoardingBase(project='functest', + case='aaa') + self.test.project = "functest" + self.test.case_name = "aaa" + self.test.start_time = "1" + self.test.stop_time = "5" + self.test.criteria = "" + self.test.details = {"orchestrator": {"status": "PASS", + "result": "", + "duration": 20}, + "vnf": {"status": "PASS", + "result": "", + "duration": 15}, + "test_vnf": {"status": "FAIL", + "result": "", + "duration": 5}} + + def test_deploy_vnf_unimplemented(self): + with self.assertRaises(Exception) as context: + self.test.deploy_vnf() + self.assertTrue('VNF not deployed' in context.exception) + + def test_test_vnf_unimplemented(self): + with self.assertRaises(Exception) as context: + self.test.test_vnf()() + self.assertTrue('VNF not tested' in context.exception) + + def test_parse_results(self): + self.assertNotEqual(self.test.parse_results(), 0) + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index 8a52a9f6..59ab2c65 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -337,7 +337,8 @@ class ODLTesting(unittest.TestCase): testcase_base.TestcaseBase.EX_RUN_ERROR) def _test_run(self, status=testcase_base.TestcaseBase.EX_OK, - exception=None, odlip="127.0.0.3", odlwebport="8080"): + exception=None, odlip="127.0.0.3", odlwebport="8080", + odlrestconfport="8181"): with mock.patch('functest.utils.openstack_utils.get_endpoint', side_effect=self._fake_url_for): if exception: @@ -348,7 +349,7 @@ class ODLTesting(unittest.TestCase): self.test.main.assert_called_once_with( keystoneip=self._keystone_ip, neutronip=self._neutron_ip, odlip=odlip, odlpassword=self._odl_password, - odlrestconfport=self._odl_restconfport, + odlrestconfport=odlrestconfport, odlusername=self._odl_username, odlwebport=odlwebport, ospassword=self._os_password, ostenantname=self._os_tenantname, osusername=self._os_username) @@ -410,7 +411,8 @@ class ODLTesting(unittest.TestCase): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "apex" self._test_run(testcase_base.TestcaseBase.EX_OK, - odlip=self._sdn_controller_ip, odlwebport='8081') + odlip=self._sdn_controller_ip, odlwebport='8081', + odlrestconfport='8081') def test_run_joid_missing_sdn_controller(self): with mock.patch('functest.utils.openstack_utils.get_endpoint', |