summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJosh Kearney <josh@jk0.org>2012-05-21 12:55:49 -0500
committerJosh Kearney <josh@jk0.org>2012-05-21 15:16:30 -0500
commite6b42d7bdf92c8dade030798436cb3e5ec652ee9 (patch)
treeee997054c29230ed0d62564dc021563a8f00728d /nova/tests
parent53583faac261f2272f81da2ee2efaff0e10bc400 (diff)
Only permit alpha-numerics and ._- for instance type names.
Fixes bug 977187. Change-Id: I883204a508f39441c172f3c42c8be3d6598c35d8
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_instance_types.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/nova/tests/test_instance_types.py b/nova/tests/test_instance_types.py
index 8b8ab1592..b790d6b1e 100644
--- a/nova/tests/test_instance_types.py
+++ b/nova/tests/test_instance_types.py
@@ -88,6 +88,13 @@ class InstanceTypeTestCase(test.TestCase):
new_list = instance_types.get_all_types()
self.assertEqual(original_list, new_list)
+ def test_instance_type_create_with_special_characters(self):
+ """Ensure instance types raises InvalidInput for invalid characters"""
+ name = "foo.bar!@#$%^-test_name"
+ flavorid = "flavor1"
+ self.assertRaises(exception.InvalidInput, instance_types.create,
+ name, 256, 1, 120, 100, flavorid)
+
def test_get_all_instance_types(self):
"""Ensures that all instance types can be retrieved"""
session = sql_session.get_session()