diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-02-25 20:34:33 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-02-25 20:34:33 +0000 |
| commit | 5d60c2bb7d9e0881eca1e0b24ab3fb178dc3a112 (patch) | |
| tree | 6e015468560a6573b9856f96dfcb055031e57aa8 | |
| parent | 30dbb742e47621305b21cb3de8a51f57e8423930 (diff) | |
| parent | 1f7f1bd3c846da88269c0c05a4f20ed4a514e063 (diff) | |
Merge "Ensure keystone unittests do not leave CONF.policyfile in bad state"
| -rw-r--r-- | tests/test_policy.py | 2 | ||||
| -rw-r--r-- | tests/test_v3_protection.py | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_policy.py b/tests/test_policy.py index 6895958c..a43c9d3e 100644 --- a/tests/test_policy.py +++ b/tests/test_policy.py @@ -32,6 +32,7 @@ CONF = config.CONF class PolicyFileTestCase(test.TestCase): def setUp(self): super(PolicyFileTestCase, self).setUp() + self.orig_policy_file = CONF.policy_file rules.reset() _unused, self.tmpfilename = tempfile.mkstemp() self.opt(policy_file=self.tmpfilename) @@ -40,6 +41,7 @@ class PolicyFileTestCase(test.TestCase): def tearDown(self): super(PolicyFileTestCase, self).tearDown() rules.reset() + self.opt(policy_file=self.orig_policy_file) def test_modified_policy_reloads(self): action = "example:test" diff --git a/tests/test_v3_protection.py b/tests/test_v3_protection.py index b211af10..bda73415 100644 --- a/tests/test_v3_protection.py +++ b/tests/test_v3_protection.py @@ -20,11 +20,15 @@ import uuid import nose.exc +from keystone import config from keystone.policy.backends import rules import test_v3 +CONF = config.CONF + + class IdentityTestProtectedCase(test_v3.RestfulTestCase): """Test policy protection of a sample of v3 identity apis""" @@ -71,6 +75,7 @@ class IdentityTestProtectedCase(test_v3.RestfulTestCase): # Initialize the policy engine and allow us to write to a temp # file in each test to create the policies + self.orig_policy_file = CONF.policy_file rules.reset() _unused, self.tmpfilename = tempfile.mkstemp() self.opt(policy_file=self.tmpfilename) @@ -85,6 +90,11 @@ class IdentityTestProtectedCase(test_v3.RestfulTestCase): self.auth['authentication']['password']['user']['password'] = ( self.user1['password']) + def tearDown(self): + super(IdentityTestProtectedCase, self).tearDown() + rules.reset() + self.opt(policy_file=self.orig_policy_file) + def _get_id_list_from_ref_list(self, ref_list): result_list = [] for x in ref_list: |
