aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/common
diff options
context:
space:
mode:
authorShobhi Jain <shobhi.jain@intel.com>2018-02-21 14:45:21 +0000
committerShobhi Jain <shobhi.jain@intel.com>2018-03-20 15:58:51 +0000
commit16aa0b60244b742c2b6478cea93b1eebce4c335f (patch)
treebd579d996b4632efe61e8ca323d1fc3d6e06af5d /yardstick/tests/unit/common
parent5f61719a12ff20df3679d01578de84110f68302f (diff)
Replace neutron router creation with shade.
Function create_neutron_router now uses shade client instead of neutron client. JIRA: YARDSTICK-890 Change-Id: I819d26f4edb3af5e50f777e8ddbadf4d24820b7f Signed-off-by: Shobhi Jain <shobhi.jain@intel.com>
Diffstat (limited to 'yardstick/tests/unit/common')
-rw-r--r--yardstick/tests/unit/common/test_openstack_utils.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/yardstick/tests/unit/common/test_openstack_utils.py b/yardstick/tests/unit/common/test_openstack_utils.py
index c6b0f46b2..e39a13f1b 100644
--- a/yardstick/tests/unit/common/test_openstack_utils.py
+++ b/yardstick/tests/unit/common/test_openstack_utils.py
@@ -161,3 +161,27 @@ class DeleteNeutronRouterTestCase(unittest.TestCase):
'router_id')
mock_logger.error.assert_called_once()
self.assertFalse(output)
+
+
+class CreateNeutronRouterTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.mock_shade_client = mock.Mock()
+ self.mock_shade_client.create_subnet = mock.Mock()
+
+ def test_create_neutron_router(self):
+ _uuid = uuidutils.generate_uuid()
+ self.mock_shade_client.create_router.return_value = {'id': _uuid}
+ output = openstack_utils.create_neutron_router(
+ self.mock_shade_client)
+ self.assertEqual(_uuid, output)
+
+ @mock.patch.object(openstack_utils, 'log')
+ def test_create_neutron_subnet_exception(self, mock_logger):
+ self.mock_shade_client.create_router.side_effect = (
+ exc.OpenStackCloudException('error message'))
+
+ output = openstack_utils.create_neutron_router(
+ self.mock_shade_client)
+ mock_logger.error.assert_called_once()
+ self.assertIsNone(output)