python-openstackclient/tests/test_clientmanager_clientcache.py
Doug Hellmann 5e4032150d Fix "help" command and implement "list server" and "show server"
blueprint client-manager
blueprint nova-client
bug 992841

Move the authentication logic into a new ClientManager class so that only commands that need to authenticate will trigger that code.
Implement "list server" and "show server" commands as examples of using the ClientManager, Lister, and ShowOne classes.

Change-Id: I9845b70b33bae4b193dbe41871bf0ca8e286a727
2012-05-04 09:35:40 -04:00

23 lines
416 B
Python

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