From 9cb8ca5a6b8a725dc8dbdb304e1fddce0663debe Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Tue, 13 Aug 2013 10:48:15 +0200 Subject: [PATCH] Remove unneccessary Property constraints from unit tests It doesn't really make a lot of sense to have constraints on the number of keys in a Map Property, or on the allowed values in a List Property. In both cases, we can and should define the Schema for each item. Neither is used anywhere in the code, since the new Schema/Constraints do not allow it, and SchemaTest.test_all_resource_schemata() tests that all existing schemata are valid. Change-Id: I24e11ec59c75ef770bf040ee8151bbe061f4a864 --- heat/tests/test_properties.py | 50 ----------------------------------- 1 file changed, 50 deletions(-) diff --git a/heat/tests/test_properties.py b/heat/tests/test_properties.py index 944ef5ad..5105a7fc 100644 --- a/heat/tests/test_properties.py +++ b/heat/tests/test_properties.py @@ -606,18 +606,6 @@ class PropertyTest(testtools.TestCase): p = properties.Property({'Type': 'List'}) self.assertRaises(TypeError, p.validate_data, {'foo': 'bar'}) - def test_list_value_list_bad(self): - schema = {'Type': 'List', - 'AllowedValues': ['foo', 'bar', 'baz']} - p = properties.Property(schema) - self.assertRaises(ValueError, p.validate_data, ['foo', 'wibble']) - - def test_list_value_list_good(self): - schema = {'Type': 'List', - 'AllowedValues': ['foo', 'bar', 'baz']} - p = properties.Property(schema) - self.assertEqual(p.validate_data(['bar', 'foo']), ['bar', 'foo']) - def test_list_maxlength_good(self): schema = {'Type': 'List', 'MaxLength': '3'} @@ -657,44 +645,6 @@ class PropertyTest(testtools.TestCase): p = properties.Property({'Type': 'Map'}) self.assertRaises(TypeError, p.validate_data, ['foo']) - def test_map_maxlength_good(self): - schema = {'Type': 'Map', - 'MaxLength': '4'} - p = properties.Property(schema) - self.assertEqual( - p.validate_data({'1': 'one', '2': 'two', '3': 'three'}), - {'1': 'one', '2': 'two', '3': 'three'}) - - def test_map_exceeded_maxlength(self): - schema = {'Type': 'Map', - 'MaxLength': '2'} - p = properties.Property(schema) - self.assertRaises(ValueError, - p.validate_data, - {'1': 'one', '2': 'two', '3': 'three'}) - - def test_map_length_in_range(self): - schema = {'Type': 'Map', - 'MinLength': '2', - 'MaxLength': '4'} - p = properties.Property(schema) - self.assertEqual( - p.validate_data({'1': 'one', '2': 'two', '3': 'three'}), - {'1': 'one', '2': 'two', '3': 'three'}) - - def test_map_minlength_good(self): - schema = {'Type': 'Map', - 'MinLength': '2'} - p = properties.Property(schema) - self.assertEqual(p.validate_data({'1': 'one', '2': 'two'}), - {'1': 'one', '2': 'two'}) - - def test_map_smaller_than_minlength(self): - schema = {'Type': 'Map', - 'MinLength': '3'} - p = properties.Property(schema) - self.assertRaises(ValueError, p.validate_data, {'1': 'one'}) - def test_map_schema_good(self): map_schema = {'valid': {'Type': 'Boolean'}} p = properties.Property({'Type': 'Map', 'Schema': map_schema}) -- 2.45.2