Merge "Separate negative tests for list_floating_ips"
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index 6387f4e..e4d03ae 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -15,11 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import uuid
-
from tempest.api.compute import base
-from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest.test import attr
@@ -78,24 +74,6 @@
finally:
self.client.delete_floating_ip(floating_ip_id)
- @attr(type=['negative', 'gate'])
- def test_get_nonexistant_floating_ip_details(self):
- # Negative test:Should not be able to GET the details
- # of non-existent floating IP
- floating_ip_id = []
- resp, body = self.client.list_floating_ips()
- for i in range(len(body)):
- floating_ip_id.append(body[i]['id'])
- # Creating a non-existent floatingIP id
- while True:
- non_exist_id = data_utils.rand_int_id(start=999)
- if self.config.service_available.neutron:
- non_exist_id = str(uuid.uuid4())
- if non_exist_id not in floating_ip_id:
- break
- self.assertRaises(exceptions.NotFound,
- self.client.get_floating_ip_details, non_exist_id)
-
@attr(type='gate')
def test_list_floating_ip_pools(self):
# Positive test:Should return the list of floating IP Pools
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
new file mode 100644
index 0000000..e7dc8ee
--- /dev/null
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
@@ -0,0 +1,48 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import uuid
+
+from tempest.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest.test import attr
+
+
+class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(FloatingIPDetailsNegativeTestJSON, cls).setUpClass()
+ cls.client = cls.floating_ips_client
+
+ @attr(type=['negative', 'gate'])
+ def test_get_nonexistent_floating_ip_details(self):
+ # Negative test:Should not be able to GET the details
+ # of non-existent floating IP
+ # Creating a non-existent floatingIP id
+ if self.config.service_available.neutron:
+ non_exist_id = str(uuid.uuid4())
+ else:
+ non_exist_id = data_utils.rand_int_id(start=999)
+ self.assertRaises(exceptions.NotFound,
+ self.client.get_floating_ip_details, non_exist_id)
+
+
+class FloatingIPDetailsNegativeTestXML(FloatingIPDetailsNegativeTestJSON):
+ _interface = 'xml'