Merge "RandomString don't skip superclass validation"

This commit is contained in:
Jenkins 2014-11-18 19:27:42 +00:00 committed by Gerrit Code Review
commit dce34d7bf5
2 changed files with 15 additions and 0 deletions

View File

@ -226,6 +226,7 @@ class RandomString(resource.Resource):
return random_string
def validate(self):
super(RandomString, self).validate()
sequence = self.properties.get(self.SEQUENCE)
char_sequences = self.properties.get(self.CHARACTER_SEQUENCES)
char_classes = self.properties.get(self.CHARACTER_CLASSES)

View File

@ -209,6 +209,20 @@ Resources:
self.assertEqual(512, len(random_string))
self.assertEqual(random_string, secret.FnGetRefId())
def test_exceeds_max_length(self):
template_random_string = '''
HeatTemplateFormatVersion: '2012-12-12'
Resources:
secret:
Type: OS::Heat::RandomString
Properties:
length: 513
'''
exc = self.assertRaises(exception.StackValidationFailed,
self.create_stack, template_random_string)
self.assertIn('length 513 is out of range (min: 1, max: 512)',
six.text_type(exc))
class TestGenerateRandomString(common.HeatTestCase):