diff --git a/magnum/tests/unit/template/__init__.py b/magnum/tests/unit/template/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/magnum/tests/unit/template/test_template.py b/magnum/tests/unit/template/test_template.py new file mode 100644 index 0000000000..3c2b5d09fa --- /dev/null +++ b/magnum/tests/unit/template/test_template.py @@ -0,0 +1,37 @@ +# Copyright 2015 Intel, Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +import os + +from glob import glob +from oslo_config import cfg +from yaml import load + + +from magnum.common import paths +from magnum.tests import base + + +cfg.CONF.register_opts([cfg.StrOpt('template_path', + default=paths.basedir_def('templates'), + help='Heat template path')]) + + +class TestTemplate(base.TestCase): + + def test_template_yaml(self): + for yml in [y for x in os.walk(cfg.CONF.template_path) + for y in glob(os.path.join(x[0], '*.yaml'))]: + with open(yml, 'r') as f: + yml_contents = f.read() + load(yml_contents)