summaryrefslogtreecommitdiff
path: root/tests/test_clientmanager_clientcache.py
blob: 200da01fd33a98686650db16d4e598eac13233d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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