summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Martinelli <stevemar@ca.ibm.com>2015-02-06 17:17:24 -0500
committerSteve Martinelli <stevemar@ca.ibm.com>2015-02-06 18:46:46 -0500
commit8013ea056b0ca6fb04eb0576c15617b13ffcb174 (patch)
tree9fd733a2b93faea46d66028a2245130821a25926
parent1adfc5f315e65edb4e72fc3267b4bd2d57298dda (diff)
downloadoslo-policy-8013ea056b0ca6fb04eb0576c15617b13ffcb174.tar.gz
Remove globals that were introduced for compatibility
Looks like only Rules and Enforcer are ever consumed, so there is no need to have globals for backwards compatibility for Check/BaseCheck/register. Change-Id: Ifc482beb2bb9d9dd25102730d6d21792f23be3af
-rw-r--r--oslo_policy/policy.py4
-rw-r--r--oslo_policy/tests/base.py4
-rw-r--r--oslo_policy/tests/test_checks.py5
3 files changed, 5 insertions, 8 deletions
diff --git a/oslo_policy/policy.py b/oslo_policy/policy.py
index 343d622..2e824c4 100644
--- a/oslo_policy/policy.py
+++ b/oslo_policy/policy.py
@@ -240,10 +240,6 @@ _opts = [
LOG = logging.getLogger(__name__)
-register = _checks.register
-BaseCheck = _checks.BaseCheck
-Check = _checks.Check
-
class PolicyNotAuthorized(Exception):
"""Default exception raised for policy enforcement failure."""
diff --git a/oslo_policy/tests/base.py b/oslo_policy/tests/base.py
index f145530..086387a 100644
--- a/oslo_policy/tests/base.py
+++ b/oslo_policy/tests/base.py
@@ -17,8 +17,10 @@ import os.path
from oslo_config import fixture as config
from oslotest import base as test_base
+from oslo_policy import _checks
from oslo_policy import policy
+
TEST_VAR_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', 'tests/var'))
@@ -33,7 +35,7 @@ class PolicyBaseTestCase(test_base.BaseTestCase):
self.addCleanup(self.enforcer.clear)
-class FakeCheck(policy.BaseCheck):
+class FakeCheck(_checks.BaseCheck):
def __init__(self, result=None):
self.result = result
diff --git a/oslo_policy/tests/test_checks.py b/oslo_policy/tests/test_checks.py
index 001f506..f7df15a 100644
--- a/oslo_policy/tests/test_checks.py
+++ b/oslo_policy/tests/test_checks.py
@@ -22,7 +22,6 @@ import six.moves.urllib.parse as urlparse
import six.moves.urllib.request as urlrequest
from oslo_policy import _checks
-from oslo_policy import policy
from oslo_policy.tests import base
@@ -32,13 +31,13 @@ class CheckRegisterTestCase(test_base.BaseTestCase):
class TestCheck(_checks.Check):
pass
- policy.register('spam', TestCheck)
+ _checks.register('spam', TestCheck)
self.assertEqual(_checks.registered_checks, dict(spam=TestCheck))
@mock.patch.object(_checks, 'registered_checks', {})
def test_register_check_decorator(self):
- @policy.register('spam')
+ @_checks.register('spam')
class TestCheck(_checks.Check):
pass