Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
172ee8f9
Commit
172ee8f9
authored
Oct 25, 2013
by
Stavros Sachtouris
Browse files
Implement "get_client" in clients.astakos
Returns the synnefo-astakosclient object
parent
b1f6632f
Changes
2
Hide whitespace changes
Inline
Side-by-side
kamaki/clients/astakos/__init__.py
View file @
172ee8f9
...
@@ -59,6 +59,12 @@ class AstakosClient(Client):
...
@@ -59,6 +59,12 @@ class AstakosClient(Client):
return
token
[
0
]
if
(
return
token
[
0
]
if
(
isinstance
(
token
,
list
)
or
isinstance
(
token
,
tuple
))
else
token
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
)
self
.
_validate_token
(
token
)
return
self
.
_astakos
[
self
.
_uuids
[
token
]]
def
authenticate
(
self
,
token
=
None
):
def
authenticate
(
self
,
token
=
None
):
"""Get authentication information and store it in this client
"""Get authentication information and store it in this client
As long as the AstakosClient instance is alive, the latest
As long as the AstakosClient instance is alive, the latest
...
...
kamaki/clients/astakos/test.py
View file @
172ee8f9
...
@@ -122,6 +122,12 @@ class AstakosClient(TestCase):
...
@@ -122,6 +122,12 @@ class AstakosClient(TestCase):
self
.
assert_dicts_are_equal
(
self
.
client
.
_uuids2usernames
,
{
uuid
:
{}})
self
.
assert_dicts_are_equal
(
self
.
client
.
_uuids2usernames
,
{
uuid
:
{}})
self
.
assert_dicts_are_equal
(
self
.
client
.
_usernames2uuids
,
{
uuid
:
{}})
self
.
assert_dicts_are_equal
(
self
.
client
.
_usernames2uuids
,
{
uuid
:
{}})
def
test_get_client
(
self
):
if
not
self
.
cached
:
self
.
_authenticate
()
from
astakosclient
import
AstakosClient
as
SNFAC
self
.
assertTrue
(
self
.
client
.
get_client
(),
SNFAC
)
def
test_get_token
(
self
):
def
test_get_token
(
self
):
self
.
_authenticate
()
self
.
_authenticate
()
uuid
=
self
.
client
.
_uuids
.
values
()[
0
]
uuid
=
self
.
client
.
_uuids
.
values
()[
0
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment