def test___init__(self, super_init): c = astakos.CachedAstakosClient(self.url, self.token) super_init.assert_called_once_with(self.url, self.token) self.assertEqual(c._astakos, dict()) self.assertEqual(c._uuids, dict()) self.assertEqual(c._cache, dict()) self.assertEqual(c._uuids2usernames, dict()) self.assertEqual(c._usernames2uuids, dict())
# # The views and conclusions contained in the software and # documentation are those of the authors and should not be # interpreted as representing official policies, either expressed # or implied, of GRNET S.A. from kamaki.cli.config import Config from kamaki.clients import astakos, cyclades, ClientError from kamaki.clients.utils import https https.patch_with_certs('/etc/ssl/certs/ca-certificates.crt') cnf = Config() CLOUD = cnf.get('global', 'default_cloud') URL = cnf.get_cloud(CLOUD, 'url') TOKEN = cnf.get_cloud(CLOUD, 'token') identity_client = astakos.CachedAstakosClient(URL, TOKEN) computeURL = identity_client.get_endpoint_url( cyclades.CycladesComputeClient.service_type) compute_client = cyclades.CycladesComputeClient(computeURL, TOKEN) img = dict(id='10b79e4d-9362-4f30-9223-3105c9a84bce') srv_name = raw_input('Server name: ') flv = compute_client.get_flavor_details(raw_input('Flavor id: ')) srv = compute_client.create_server(srv_name, flavor_id=flv['id'], image_id=img['id']) from base64 import b64encode ssh_keys = dict(contents=b64encode(open('~/.ssh/id_rsa.pub').read()),
def setUp(self): self.url = 'https://astakos.example.com' self.token = 'ast@k0sT0k3n==' self.client = astakos.CachedAstakosClient(self.url, self.token)