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_install_config(self): fd, path = tempfile.mkstemp() with os.fdopen(fd, 'w') as t: t.write(json.dumps(CONFIG)) t.flush() tmpdir = tempfile.mkdtemp() oca.install_config([path], TEMPLATES, tmpdir, False) for path, contents in OUTPUT.items(): full_path = os.path.join(tmpdir, path[1:]) assert os.path.exists(full_path) self.assertEqual(open(full_path).read(), contents)