summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDolph Mathews <dolph.mathews@gmail.com>2013-03-19 17:15:25 -0500
committerDolph Mathews <dolph.mathews@gmail.com>2013-03-20 10:37:48 -0500
commit7db01cd64be2ab3ed5ffc00636d187ef432294b2 (patch)
tree05d562d8e66b138116b8753efa5d8195c9abfd57 /tests
parent5cb8e1f2e5e12cf7e8c6bce91af53b901f6254a9 (diff)
downloadkeystone-7db01cd64be2ab3ed5ffc00636d187ef432294b2.tar.gz
keystone-7db01cd64be2ab3ed5ffc00636d187ef432294b2.tar.xz
keystone-7db01cd64be2ab3ed5ffc00636d187ef432294b2.zip
Wrap config module and require manual setup (bug 1143998)
This moves keystone.config to keystone.common.config, which requires .configure() to be called manually in order for options to be registered. keystone.config preserves the existing behavior of automatically registering options when imported. keystone.middleware.auth_token and it's dependencies within keystone no longer cause config options to be automatically registered. This is an alternative to https://review.openstack.org/#/c/24251/ Change-Id: If9eb5799bf77595ecb71f2000f8b6d1610ea9700
Diffstat (limited to 'tests')
-rw-r--r--tests/_test_import_auth_token.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/_test_import_auth_token.py b/tests/_test_import_auth_token.py
new file mode 100644
index 00000000..4e16f9a4
--- /dev/null
+++ b/tests/_test_import_auth_token.py
@@ -0,0 +1,25 @@
+"""This is an isolated test to prevent unexpected imports.
+
+This module must be run in isolation, e.g.:
+
+ $ ./run_tests.sh _test_import_auth_token.py
+
+This module can be removed when keystone.middleware.auth_token is removed.
+
+"""
+
+import unittest
+
+
+class TestAuthToken(unittest.TestCase):
+ def test_import(self):
+ # a consuming service like nova would import oslo.config first
+ from oslo.config import cfg
+ conf = cfg.CONF
+
+ # define some config options
+ conf.register_opt(cfg.BoolOpt('debug', default=False))
+
+ # and then import auth_token as a filter
+ from keystone.middleware import auth_token
+ self.assertTrue(auth_token)