pep8
This commit is contained in:
@@ -51,20 +51,20 @@ class InstanceTypeTestCase(test.TestCase):
|
|||||||
"""return an instance type name not in the DB"""
|
"""return an instance type name not in the DB"""
|
||||||
nonexistant_flavor = "sdfsfsdf"
|
nonexistant_flavor = "sdfsfsdf"
|
||||||
flavors = instance_types.get_all_types()
|
flavors = instance_types.get_all_types()
|
||||||
while flavors.has_key(nonexistant_flavor):
|
while nonexistant_flavor in flavors:
|
||||||
nonexistant_flavor = nonexistant_flavor.join("z")
|
nonexistant_flavor = nonexistant_flavor.join("z")
|
||||||
else:
|
else:
|
||||||
return nonexistant_flavor
|
return nonexistant_flavor
|
||||||
|
|
||||||
def _nonexistant_flavor_id(self):
|
def _nonexistant_flavor_id(self):
|
||||||
"""return an instance type ID not in the DB"""
|
"""return an instance type ID not in the DB"""
|
||||||
nonexistant_flavor = 2700
|
nonexistant_flavor = 2700
|
||||||
flavor_ids = [ value["id"] for key, value in\
|
flavor_ids = [value["id"] for key, value in\
|
||||||
instance_types.get_all_types().iteritems() ]
|
instance_types.get_all_types().iteritems()]
|
||||||
while nonexistant_flavor in flavor_ids:
|
while nonexistant_flavor in flavor_ids:
|
||||||
nonexistant_flavor += 1
|
nonexistant_flavor += 1
|
||||||
else:
|
else:
|
||||||
return nonexistant_flavor
|
return nonexistant_flavor
|
||||||
|
|
||||||
def _existing_flavor(self):
|
def _existing_flavor(self):
|
||||||
"""return first instance type name"""
|
"""return first instance type name"""
|
||||||
@@ -127,12 +127,12 @@ class InstanceTypeTestCase(test.TestCase):
|
|||||||
self.assertRaises(exception.ApiError,
|
self.assertRaises(exception.ApiError,
|
||||||
instance_types.destroy,
|
instance_types.destroy,
|
||||||
self._nonexistant_flavor_name())
|
self._nonexistant_flavor_name())
|
||||||
|
|
||||||
def test_will_not_purge_without_name(self):
|
def test_will_not_purge_without_name(self):
|
||||||
"""Ensure purge without a name raises error"""
|
"""Ensure purge without a name raises error"""
|
||||||
self.assertRaises(exception.InvalidInstanceType,
|
self.assertRaises(exception.InvalidInstanceType,
|
||||||
instance_types.purge, None)
|
instance_types.purge, None)
|
||||||
|
|
||||||
def test_will_not_purge_with_wrong_name(self):
|
def test_will_not_purge_with_wrong_name(self):
|
||||||
"""Ensure purge without correct name raises error"""
|
"""Ensure purge without correct name raises error"""
|
||||||
self.assertRaises(exception.ApiError,
|
self.assertRaises(exception.ApiError,
|
||||||
@@ -149,7 +149,7 @@ class InstanceTypeTestCase(test.TestCase):
|
|||||||
"""Ensure get by name returns default flavor with no name"""
|
"""Ensure get by name returns default flavor with no name"""
|
||||||
self.assertEqual(instance_types.get_default_instance_type(),
|
self.assertEqual(instance_types.get_default_instance_type(),
|
||||||
instance_types.get_instance_type_by_name(None))
|
instance_types.get_instance_type_by_name(None))
|
||||||
|
|
||||||
def test_will_not_get_instance_type_with_bad_name(self):
|
def test_will_not_get_instance_type_with_bad_name(self):
|
||||||
"""Ensure get by name returns default flavor with bad name"""
|
"""Ensure get by name returns default flavor with bad name"""
|
||||||
self.assertRaises(exception.InstanceTypeNotFound,
|
self.assertRaises(exception.InstanceTypeNotFound,
|
||||||
|
|||||||
Reference in New Issue
Block a user