Remove duplicate negative test of flavor_id
As tempest/api/compute/admin/test_flavors.py, it is possible to
specify uuid as flavor_id. In addition, Nova creates a flavor with
uuid flavor_id if passing None as the API parameter of flavor_id.
Then, test_get_flavor_details_for_invalid_flavor_id is not an
"invalid id" test, the test is a "non existent id" test.
So the test and test_non_existent_flavor_id are duplicated, and
this patch merges them to one test.
Change-Id: I73f79f82f48a49208500c2542e55c026f120e921
diff --git a/tempest/api/compute/flavors/test_flavors_negative.py b/tempest/api/compute/flavors/test_flavors_negative.py
index 81e4f87..0b20e90 100644
--- a/tempest/api/compute/flavors/test_flavors_negative.py
+++ b/tempest/api/compute/flavors/test_flavors_negative.py
@@ -18,7 +18,6 @@
import uuid
from tempest.api.compute import base
-from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@@ -31,14 +30,6 @@
super(FlavorsNegativeTestJSON, cls).setUpClass()
cls.client = cls.flavors_client
- # Generating a nonexistent flavor id
- resp, flavors = cls.client.list_flavors()
- flavor_ids = [flavor['id'] for flavor in flavors]
- while True:
- cls.nonexistent_flavor_id = data_utils.rand_int_id(start=999)
- if cls.nonexistent_flavor_id not in flavor_ids:
- break
-
@attr(type=['negative', 'gate'])
def test_invalid_minRam_filter(self):
self.assertRaises(exceptions.BadRequest,
@@ -52,17 +43,11 @@
{'minDisk': 'invalid'})
@attr(type=['negative', 'gate'])
- def test_get_flavor_details_for_invalid_flavor_id(self):
- # Ensure 404 returned for invalid flavor ID
- invalid_flavor_id = str(uuid.uuid4())
- self.assertRaises(exceptions.NotFound, self.client.get_flavor_details,
- invalid_flavor_id)
-
- @attr(type=['negative', 'gate'])
def test_non_existent_flavor_id(self):
# flavor details are not returned for non-existent flavors
+ nonexistent_flavor_id = str(uuid.uuid4())
self.assertRaises(exceptions.NotFound, self.client.get_flavor_details,
- self.nonexistent_flavor_id)
+ nonexistent_flavor_id)
class FlavorsNegativeTestXML(FlavorsNegativeTestJSON):