2014-04-30 14:49:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
def test_manifest_generator():
|
2016-03-04 00:32:48 +01:00
|
|
|
"""
|
|
|
|
manifests_tests - test_manifest_generator.
|
2014-04-30 14:49:26 -05:00
|
|
|
|
2016-03-04 00:32:48 +01:00
|
|
|
Loops through the manifests directory and tests that
|
|
|
|
each file can successfully be loaded and validated.
|
|
|
|
"""
|
2016-03-04 00:44:42 +01:00
|
|
|
|
|
|
|
from nose.tools import assert_true
|
|
|
|
from bootstrapvz.base.manifest import Manifest
|
|
|
|
|
|
|
|
def validate_manifest(path):
|
|
|
|
manifest = Manifest(path=path)
|
|
|
|
assert_true(manifest.data)
|
|
|
|
assert_true(manifest.data['name'])
|
|
|
|
assert_true(manifest.data['provider'])
|
|
|
|
assert_true(manifest.data['bootstrapper'])
|
|
|
|
assert_true(manifest.data['volume'])
|
|
|
|
assert_true(manifest.data['system'])
|
|
|
|
|
2016-03-04 00:32:48 +01:00
|
|
|
import os.path
|
|
|
|
from .. import recursive_glob
|
2016-03-04 00:44:42 +01:00
|
|
|
from itertools import chain
|
2016-03-04 00:32:48 +01:00
|
|
|
manifests = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
|
|
'../../manifests')
|
2016-03-04 00:44:42 +01:00
|
|
|
manifest_paths = chain(recursive_glob(manifests, '*.yml'), recursive_glob(manifests, '*.json'))
|
|
|
|
for manifest_path in manifest_paths:
|
|
|
|
validate_manifest.description = "Validating %s" % os.path.relpath(manifest_path, manifests)
|
|
|
|
yield validate_manifest, manifest_path
|