X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Ftests%2Funit%2Fodl%2Ftest_odl.py;h=6304d37a3258370cc51be0c74a9ffe816f735d3f;hb=1b0c4e1e2466dd92585ddb06ff00198ae62e2ebd;hp=aa31703b86267a37aa04197a2a91a31f0c7efd3c;hpb=d262b55a1e29b1202cd584f859d2d221d9addb8c;p=functest.git diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index aa31703b8..6304d37a3 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -17,8 +17,8 @@ import mock from robot.errors import RobotError import six from six.moves import urllib +from xtesting.core import testcase -from functest.core import testcase from functest.opnfv_tests.sdn.odl import odl __author__ = "Cedric Ollivier " @@ -171,6 +171,7 @@ class ODLMainTesting(ODLTesting): 'RESTCONFPORT:{}'.format(self._odl_restconfport)] args[1].assert_called_once_with( odl.ODLTests.basic_suite_dir, odl.ODLTests.neutron_suite_dir, + include=[], log='NONE', output=os.path.join(self.test.res_dir, 'output.xml'), report='NONE', stdout=mock.ANY, variable=variable, @@ -278,6 +279,15 @@ class ODLRunTesting(ODLTesting): args[0].assert_called_once_with() args[1].assert_called_once_with(mock.ANY, 'network') + @mock.patch('snaps.openstack.utils.keystone_utils.get_endpoint', + return_value=ODLTesting._neutron_url) + @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.' + 'get_credentials') + def _test_missing_value(self, *args): + self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) + args[0].assert_called_once_with() + args[1].assert_called_once_with(mock.ANY, 'network') + @mock.patch('snaps.openstack.utils.keystone_utils.get_endpoint', return_value=ODLTesting._neutron_url) @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.' @@ -361,7 +371,7 @@ class ODLRunTesting(ODLTesting): odlwebport=self._odl_webport) def test_no_sdn_controller_ip(self): - self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) + self._test_missing_value() def test_without_installer_type(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip @@ -377,16 +387,21 @@ class ODLRunTesting(ODLTesting): odlip=self._sdn_controller_ip, odlwebport=self._odl_webport) + def test_fuel_no_controller_ip(self): + os.environ["INSTALLER_TYPE"] = "fuel" + self._test_missing_value() + def test_fuel(self): + os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "fuel" self._test_run(testcase.TestCase.EX_OK, None, - odlip=urllib.parse.urlparse(self._neutron_url).hostname, - odlwebport='8181', + odlip=self._sdn_controller_ip, + odlwebport='8282', odlrestconfport='8282') def test_apex_no_controller_ip(self): os.environ["INSTALLER_TYPE"] = "apex" - self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) + self._test_missing_value() def test_apex(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip @@ -397,7 +412,7 @@ class ODLRunTesting(ODLTesting): def test_netvirt_no_controller_ip(self): os.environ["INSTALLER_TYPE"] = "netvirt" - self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) + self._test_missing_value() def test_netvirt(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip @@ -407,14 +422,15 @@ class ODLRunTesting(ODLTesting): odlrestconfport='8081') def test_compass(self): + os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "compass" self._test_run(testcase.TestCase.EX_OK, None, - odlip=urllib.parse.urlparse(self._neutron_url).hostname, + odlip=self._sdn_controller_ip, odlrestconfport='8080') def test_daisy_no_controller_ip(self): os.environ["INSTALLER_TYPE"] = "daisy" - self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) + self._test_missing_value() def test_daisy(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip