|
|
|
@ -339,6 +339,37 @@ class ProviderTemplateTest(HeatTestCase):
|
|
|
|
|
self.assertRaises(exception.StackValidationFailed,
|
|
|
|
|
temp_res.validate)
|
|
|
|
|
|
|
|
|
|
def test_boolean_type_provider(self):
|
|
|
|
|
provider = {
|
|
|
|
|
'HeatTemplateFormatVersion': '2012-12-12',
|
|
|
|
|
'Parameters': {
|
|
|
|
|
'Foo': {'Type': 'Boolean'},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
files = {'test_resource.template': json.dumps(provider)}
|
|
|
|
|
|
|
|
|
|
class DummyResource(object):
|
|
|
|
|
properties_schema = {"Foo":
|
|
|
|
|
properties.Schema(properties.Schema.BOOLEAN)}
|
|
|
|
|
attributes_schema = {}
|
|
|
|
|
|
|
|
|
|
env = environment.Environment()
|
|
|
|
|
resource._register_class('DummyResource', DummyResource)
|
|
|
|
|
env.load({'resource_registry':
|
|
|
|
|
{'DummyResource': 'test_resource.template'}})
|
|
|
|
|
stack = parser.Stack(utils.dummy_context(), 'test_stack',
|
|
|
|
|
parser.Template(
|
|
|
|
|
{'HeatTemplateFormatVersion': '2012-12-12'},
|
|
|
|
|
files=files), env=env,
|
|
|
|
|
stack_id=str(uuid.uuid4()))
|
|
|
|
|
|
|
|
|
|
definition = rsrc_defn.ResourceDefinition('test_t_res',
|
|
|
|
|
"DummyResource",
|
|
|
|
|
{"Foo": "False"})
|
|
|
|
|
temp_res = template_resource.TemplateResource('test_t_res',
|
|
|
|
|
definition, stack)
|
|
|
|
|
self.assertIsNone(temp_res.validate())
|
|
|
|
|
|
|
|
|
|
def test_get_template_resource(self):
|
|
|
|
|
# assertion: if the name matches {.yaml|.template} we get the
|
|
|
|
|
# TemplateResource class.
|
|
|
|
|