Test subhash
This commit is contained in:
parent
bbb887decd
commit
8107f6ef8c
|
@ -22,6 +22,16 @@ CONFIG = {
|
|||
}
|
||||
}
|
||||
|
||||
# config for example tree - with subhash
|
||||
CONFIG_SUBHASH = {
|
||||
"OpenStack::Config": {
|
||||
"x": "foo",
|
||||
"database": {
|
||||
"url": "sqlite:///blah"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# expected output for example tree
|
||||
OUTPUT = {
|
||||
"/etc/glance/script.conf": "foo\n",
|
||||
|
@ -51,6 +61,17 @@ def test_install_config():
|
|||
assert os.path.exists(full_path)
|
||||
assert_equal( open(full_path).read(), contents )
|
||||
|
||||
def test_install_config_subhash():
|
||||
t = tempfile.NamedTemporaryFile()
|
||||
t.write(json.dumps(CONFIG_SUBHASH))
|
||||
t.flush()
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
install_config(t.name, TEMPLATES, tmpdir, False, 'OpenStack::Config')
|
||||
for path, contents in OUTPUT.items():
|
||||
full_path = os.path.join(tmpdir, path[1:])
|
||||
assert os.path.exists(full_path)
|
||||
assert_equal( open(full_path).read(), contents )
|
||||
|
||||
def test_print_key():
|
||||
t = tempfile.NamedTemporaryFile()
|
||||
t.write(json.dumps(CONFIG))
|
||||
|
|
Loading…
Reference in New Issue