Commit 172ee8f9 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Implement "get_client" in clients.astakos

Returns the synnefo-astakosclient object
parent b1f6632f
......@@ -59,6 +59,12 @@ class AstakosClient(Client):
return token[0] if (
isinstance(token, list) or isinstance(token, tuple)) else token
def get_client(self, token=None):
"""Get the Synnefo AstakosClient instance used by client"""
token = self._resolve_token(token)
return self._astakos[self._uuids[token]]
def authenticate(self, token=None):
"""Get authentication information and store it in this client
As long as the AstakosClient instance is alive, the latest
......@@ -122,6 +122,12 @@ class AstakosClient(TestCase):
self.assert_dicts_are_equal(self.client._uuids2usernames, {uuid: {}})
self.assert_dicts_are_equal(self.client._usernames2uuids, {uuid: {}})
def test_get_client(self):
if not self.cached:
from astakosclient import AstakosClient as SNFAC
self.assertTrue(self.client.get_client(), SNFAC)
def test_get_token(self):
uuid = self.client._uuids.values()[0]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment