def _authenticate(self): auth = self.config_dict['auth'] url, token = auth['url'], auth['token'] ca_certs = auth.get('ca_certs') if ca_certs: utils.https.patch_with_certs(ca_certs) elif auth.get('ignore_ssl').lower() in ('true', 'yes', 'on'): utils.https.patch_ignore_ssl() self.astakos = astakos.AstakosClient(url, token)
def test___init__(self, init): for args, kwargs in ((['some url', 'some token'], {}), (['some url', 'some token', 'other', 'params'], {}), (['some url', 'some token', 'other params'], (dict(k='v'))), (['some url', 'some token'], (dict(k1='v1', k2='v2'))), ([ 'some url', ], (dict(k1='v1', k2='v2', token='some token')))): astakos.AstakosClient(*args, **kwargs) url, token = args.pop(0), kwargs.pop('token', None) or args.pop(0) self.assertTrue(init.mock_calls[-1], call(token, url, *args, **kwargs))
cnf = Config() CLOUD = cnf.get('global', 'default_cloud') URL = cnf.get_cloud(CLOUD, 'url') TOKEN = cnf.get_cloud(CLOUD, 'token') from kamaki.cli import logger logger.add_stream_logger('kamaki.clients.recv', fmt='< %(message)s') logger.add_stream_logger('kamaki.clients.send', fmt='> %(message)s') from kamaki.clients import astakos, pithos, cyclades, image from kamaki.clients.utils import https https.patch_with_certs('/etc/ssl/certs/ca-certificates.crt') identity_client = astakos.AstakosClient(URL, TOKEN) pithosURL = identity_client.get_endpoint_url(pithos.PithosClient.service_type) storage_client = pithos.PithosClient(pithosURL, TOKEN) storage_client.account = identity_client.user_info['id'] storage_client.container = 'pithos' imageURL = identity_client.get_endpoint_url(image.ImageClient.service_type) image_client = image.ImageClient(imageURL, TOKEN) computeURL = identity_client.get_endpoint_url( cyclades.CycladesComputeClient.service_type) compute_client = cyclades.CycladesComputeClient(computeURL, TOKEN) networkURL = identity_client.get_endpoint_url( cyclades.CycladesNetworkClient.service_type)
def setUp(self): self.url, self.token = 'https://astakos.example.com', 'ast@k0sT0k3n==' self.client = astakos.AstakosClient(self.url, self.token)