diff options
author | Shobhi Jain <shobhi.jain@intel.com> | 2018-02-05 15:18:43 +0000 |
---|---|---|
committer | Shobhi Jain <shobhi.jain@intel.com> | 2018-03-12 10:39:49 +0000 |
commit | 5bb06d8977dc1ffa18c47cd1b152f84f4a6cfa34 (patch) | |
tree | 4e190c3c8e54b3b21ab397dfa57d4722aa462615 /yardstick/tests/unit/common | |
parent | 066a45edd22be0fa7dec8986b850d672a86ad0a3 (diff) |
Replace neutron network creation with shade.
Function create_neutron_net now uses shade client instead of neutron
client.
JIRA: YARDSTICK-890
Change-Id: I456078e98550901c1f736640c9f9bd0d5f9c3df6
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.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/yardstick/tests/unit/common/test_openstack_utils.py b/yardstick/tests/unit/common/test_openstack_utils.py index 4863f05c0..a63661025 100644 --- a/yardstick/tests/unit/common/test_openstack_utils.py +++ b/yardstick/tests/unit/common/test_openstack_utils.py @@ -83,3 +83,28 @@ class DeleteNeutronNetTestCase(unittest.TestCase): 'network_id') self.assertFalse(output) mock_logger.error.assert_called_once() + + +class CreateNeutronNetTestCase(unittest.TestCase): + + def setUp(self): + self.mock_shade_client = mock.Mock() + self.network_name = 'name' + self.mock_shade_client.create_network = mock.Mock() + + def test_create_neutron_net(self): + _uuid = uuidutils.generate_uuid() + self.mock_shade_client.create_network.return_value = {'id': _uuid} + output = openstack_utils.create_neutron_net(self.mock_shade_client, + self.network_name) + self.assertEqual(_uuid, output) + + @mock.patch.object(openstack_utils, 'log') + def test_create_neutron_net_exception(self, mock_logger): + self.mock_shade_client.create_network.side_effect = ( + exc.OpenStackCloudException('error message')) + + output = openstack_utils.create_neutron_net(self.mock_shade_client, + self.network_name) + mock_logger.error.assert_called_once() + self.assertIsNone(output) |