Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(8)  |  Derive(0)  |  Import(1)

src/s/y/synnefo-HEAD/snf-cyclades-app/synnefo/db/models.py   synnefo(Download)
from synnefo.db import pools, fields
 
from synnefo.logic.rapi_pool import (get_rapi_client,
                                     put_rapi_client)
 
            raise faults.ServiceUnavailable("Backend '%s' is offline" %
                                            self)
        return get_rapi_client(self.id, self.hash,
                               self.clustername,
                               self.port,
 
        b = backend
        client = get_rapi_client(b.id, b.hash, b.clustername, b.port,
                                 b.username, b.password)
        try:

src/s/y/synnefo-HEAD/snf-cyclades-app/synnefo/logic/tests/rapi_pool_tests.py   synnefo(Download)
    def test_new_client(self, rclient):
        cl = rapi_pool.get_rapi_client(1, 'amxixa', 'cluster0', '5080', 'user',
                                       'pass')
        rclient.assert_called_once_with("cluster0", "5080", "user", "pass")
        self.assertTrue('amxixa' in rapi_pool._pools)
    def test_get_from_pool(self, rclient):
        cl = rapi_pool.get_rapi_client(1, 'dummyhash', 'cluster1', '5080',
                                       'user', 'pass')
        rclient.assert_called_once_with("cluster1", "5080", "user", "pass")
        rapi_pool.put_rapi_client(cl)
        rclient.reset_mock()
        cl2 = rapi_pool.get_rapi_client(1, 'dummyhash', 'cluster1', '5080',
    def test_changed_credentials(self, rclient):
        cl = rapi_pool.get_rapi_client(1, 'dummyhash2', 'cluster2', '5080',
                                       'user', 'pass')
        rclient.assert_called_once_with("cluster2", "5080", "user", "pass")
        rapi_pool.put_rapi_client(cl)
        rclient.reset_mock()
        rapi_pool.get_rapi_client(1, 'dummyhash3', 'cluster2', '5080',