aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/common/test_openstack_utils.py
diff options
context:
space:
mode:
authorShobhi Jain <shobhi.jain@intel.com>2018-02-27 13:19:00 +0000
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-03-27 15:17:08 +0000
commitc68bf22cc439eb72b6b237258f126776d7e58fb6 (patch)
tree55df6692a0c0679671c6234901c5bd52da78f815 /yardstick/tests/unit/common/test_openstack_utils.py
parent221da2200131f617d36f3143e730f9dcfab530d0 (diff)
Replace neutron floating ip deletion with shade.
Function delete_floating_ip now uses shade client. JIRA: YARDSTICK-890 Change-Id: I960630926b664266afbe7be00bb1352243b41be0 Signed-off-by: Shobhi Jain <shobhi.jain@intel.com>
Diffstat (limited to 'yardstick/tests/unit/common/test_openstack_utils.py')
-rw-r--r--yardstick/tests/unit/common/test_openstack_utils.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/yardstick/tests/unit/common/test_openstack_utils.py b/yardstick/tests/unit/common/test_openstack_utils.py
index eb96aef84..b8f85c083 100644
--- a/yardstick/tests/unit/common/test_openstack_utils.py
+++ b/yardstick/tests/unit/common/test_openstack_utils.py
@@ -210,3 +210,32 @@ class CreateFloatingIpTestCase(unittest.TestCase):
self.mock_shade_client, self.network_name_or_id)
mock_logger.error.assert_called_once()
self.assertIsNone(output)
+
+
+class DeleteFloatingIpTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.mock_shade_client = mock.Mock()
+ self.floating_ip_id = 'floating_ip_id'
+ self.mock_shade_client.delete_floating_ip = mock.Mock()
+
+ def test_delete_floating_ip(self):
+ self.mock_shade_client.delete_floating_ip.return_value = True
+ output = openstack_utils.delete_floating_ip(self.mock_shade_client,
+ 'floating_ip_id')
+ self.assertTrue(output)
+
+ def test_delete_floating_ip_fail(self):
+ self.mock_shade_client.delete_floating_ip.return_value = False
+ output = openstack_utils.delete_floating_ip(self.mock_shade_client,
+ 'floating_ip_id')
+ self.assertFalse(output)
+
+ @mock.patch.object(openstack_utils, 'log')
+ def test_delete_floating_ip_exception(self, mock_logger):
+ self.mock_shade_client.delete_floating_ip.side_effect = (
+ exc.OpenStackCloudException('error message'))
+ output = openstack_utils.delete_floating_ip(self.mock_shade_client,
+ 'floating_ip_id')
+ mock_logger.error.assert_called_once()
+ self.assertFalse(output)