Merge "Make policy file support in fixture optional"
This commit is contained in:
commit
b0536db02a
|
@ -682,7 +682,7 @@ class TestCase(BaseTestCase):
|
|||
return []
|
||||
|
||||
def _policy_fixture(self):
|
||||
return ksfixtures.Policy(dirs.etc('policy.json'), self.config_fixture)
|
||||
return ksfixtures.Policy(self.config_fixture)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def make_request(self, path='/', **kwargs):
|
||||
|
|
|
@ -20,7 +20,7 @@ from keystone.common.rbac_enforcer import policy
|
|||
class Policy(fixtures.Fixture):
|
||||
"""A fixture for working with policy configuration."""
|
||||
|
||||
def __init__(self, policy_file, config_fixture):
|
||||
def __init__(self, config_fixture, policy_file=None):
|
||||
self._policy_file = policy_file
|
||||
self._config_fixture = config_fixture
|
||||
|
||||
|
|
|
@ -46,7 +46,9 @@ class PolicyFileTestCase(unit.TestCase):
|
|||
self.target = {}
|
||||
|
||||
def _policy_fixture(self):
|
||||
return ksfixtures.Policy(self.tmpfilename, self.config_fixture)
|
||||
return ksfixtures.Policy(
|
||||
self.config_fixture, policy_file=self.tmpfilename
|
||||
)
|
||||
|
||||
def test_modified_policy_reloads(self):
|
||||
action = "example:test"
|
||||
|
|
|
@ -2600,8 +2600,10 @@ class TestTokenRevokeSelfAndAdmin(test_v3.RestfulTestCase):
|
|||
)
|
||||
|
||||
def _policy_fixture(self):
|
||||
return ksfixtures.Policy(unit.dirs.etc('policy.v3cloudsample.json'),
|
||||
self.config_fixture)
|
||||
return ksfixtures.Policy(
|
||||
self.config_fixture,
|
||||
policy_file=unit.dirs.etc('policy.v3cloudsample.json')
|
||||
)
|
||||
|
||||
def test_user_revokes_own_token(self):
|
||||
user_token = self.get_requested_token(
|
||||
|
|
|
@ -39,7 +39,9 @@ class IdentityTestFilteredCase(filtering.FilterTests,
|
|||
"""Test filter enforcement on the v3 Identity API."""
|
||||
|
||||
def _policy_fixture(self):
|
||||
return ksfixtures.Policy(self.tmpfilename, self.config_fixture)
|
||||
return ksfixtures.Policy(
|
||||
self.config_fixture, policy_file=self.tmpfilename
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
"""Setup for Identity Filter Test Cases."""
|
||||
|
|
|
@ -37,7 +37,9 @@ class IdentityTestProtectedCase(test_v3.RestfulTestCase):
|
|||
"""Test policy enforcement on the v3 Identity API."""
|
||||
|
||||
def _policy_fixture(self):
|
||||
return ksfixtures.Policy(self.tmpfilename, self.config_fixture)
|
||||
return ksfixtures.Policy(
|
||||
self.config_fixture, policy_file=self.tmpfilename
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
"""Setup for Identity Protection Test Cases.
|
||||
|
@ -643,8 +645,10 @@ class IdentityTestv3CloudPolicySample(test_v3.RestfulTestCase,
|
|||
"""Test policy enforcement of the sample v3 cloud policy file."""
|
||||
|
||||
def _policy_fixture(self):
|
||||
return ksfixtures.Policy(unit.dirs.etc('policy.v3cloudsample.json'),
|
||||
self.config_fixture)
|
||||
return ksfixtures.Policy(
|
||||
self.config_fixture,
|
||||
policy_file=unit.dirs.etc('policy.v3cloudsample.json')
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
"""Setup for v3 Cloud Policy Sample Test Cases.
|
||||
|
|
Loading…
Reference in New Issue