From 8b8981ab8e0cd5039f0a299797ef1e8e097e3ace Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 11 Jan 2013 16:31:11 +0100 Subject: [PATCH] Enhance policy test for init() As suggested by Doug, let's write real data and see if they were read. Change-Id: If709b36634b4352ce7e5a3d40b58bfba0f9ae91d Signed-off-by: Julien Danjou --- tests/test_policy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_policy.py b/tests/test_policy.py index 79572ead1..375ea0453 100644 --- a/tests/test_policy.py +++ b/tests/test_policy.py @@ -39,11 +39,13 @@ class TestPolicy(base.TestCase): pass def test_init(self): + json_data = "{\"is_fun\": [[\"role:clown\"]]}" cfg.CONF([]) cfg.CONF.policy_file = tempfile.mktemp() with open(cfg.CONF.policy_file, "w") as f: - f.write("{}") + f.write(json_data) policy.init() + self.assertEqual(policy._POLICY_CACHE['data'], json_data) def test_init_file_not_found(self): cfg.CONF([])