Merge "Enhance policy test for init()"

This commit is contained in:
Jenkins 2013-01-14 05:50:02 +00:00 committed by Gerrit Code Review
commit edd9332323

View File

@ -39,11 +39,13 @@ class TestPolicy(base.TestCase):
pass pass
def test_init(self): def test_init(self):
json_data = "{\"is_fun\": [[\"role:clown\"]]}"
cfg.CONF([]) cfg.CONF([])
cfg.CONF.policy_file = tempfile.mktemp() cfg.CONF.policy_file = tempfile.mktemp()
with open(cfg.CONF.policy_file, "w") as f: with open(cfg.CONF.policy_file, "w") as f:
f.write("{}") f.write(json_data)
policy.init() policy.init()
self.assertEqual(policy._POLICY_CACHE['data'], json_data)
def test_init_file_not_found(self): def test_init_file_not_found(self):
cfg.CONF([]) cfg.CONF([])