summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_clientmanager_clientcache.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_clientmanager_clientcache.py b/tests/test_clientmanager_clientcache.py
new file mode 100644
index 00000000..200da01f
--- /dev/null
+++ b/tests/test_clientmanager_clientcache.py
@@ -0,0 +1,22 @@
+
+from openstackclient.common import clientmanager
+
+
+def factory(inst):
+ return object()
+
+
+class Container(object):
+
+ attr = clientmanager.ClientCache(factory)
+
+ def init_token(self):
+ return
+
+
+def test_singleton():
+ # Verify that the ClientCache descriptor only
+ # invokes the factory one time and always
+ # returns the same value after that.
+ c = Container()
+ assert c.attr is c.attr