summaryrefslogtreecommitdiff
path: root/keystoneclient/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-04-08 06:47:31 +0000
committerGerrit Code Review <review@openstack.org>2015-04-08 06:47:31 +0000
commit045c9dab6dfd599de42a7a7ac4a677e1a793b67f (patch)
tree05edbf761de6fe1b49c1cee9865141d1788291a7 /keystoneclient/tests
parent53dc900025c34378854425f40e3dea82d0416254 (diff)
parente39eec0ff84185f476a1c4cd3014decd149ddf58 (diff)
downloadpython-keystoneclient-045c9dab6dfd599de42a7a7ac4a677e1a793b67f.tar.gz
Merge "Provide a generic auth plugin loader"
Diffstat (limited to 'keystoneclient/tests')
-rw-r--r--keystoneclient/tests/unit/auth/test_loading.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/keystoneclient/tests/unit/auth/test_loading.py b/keystoneclient/tests/unit/auth/test_loading.py
new file mode 100644
index 0000000..f8ef3b7
--- /dev/null
+++ b/keystoneclient/tests/unit/auth/test_loading.py
@@ -0,0 +1,47 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import uuid
+
+import six
+
+from keystoneclient.tests.unit.auth import utils
+
+
+class TestOtherLoading(utils.TestCase):
+
+ def test_loading_getter(self):
+
+ called_opts = []
+
+ vals = {'a-int': 44,
+ 'a-bool': False,
+ 'a-float': 99.99,
+ 'a-str': 'value'}
+
+ val = uuid.uuid4().hex
+
+ def _getter(opt):
+ called_opts.append(opt.name)
+ # return str because oslo.config should convert them back
+ return str(vals[opt.name])
+
+ p = utils.MockPlugin.load_from_options_getter(_getter, other=val)
+
+ self.assertEqual(set(vals), set(called_opts))
+
+ for k, v in six.iteritems(vals):
+ # replace - to _ because it's the dest used to create kwargs
+ self.assertEqual(v, p[k.replace('-', '_')])
+
+ # check that additional kwargs get passed through
+ self.assertEqual(val, p['other'])