Revision 8975f6f6
b/astakosclient/astakosclient/__init__.py | ||
---|---|---|
201 | 201 |
else: |
202 | 202 |
return None |
203 | 203 |
except Exception as err: |
204 |
self.logger.error("Cannot parse response \"%s\" with simplejson: %s"
|
|
205 |
% (data, str(err)))
|
|
204 |
msg = "Cannot parse response \"%s\" with simplejson: %s"
|
|
205 |
self.logger.error(msg % (data, str(err)))
|
|
206 | 206 |
raise InvalidResponse(str(err), data) |
207 | 207 |
|
208 | 208 |
# ------------------------ |
b/astakosclient/astakosclient/keypath.py | ||
---|---|---|
30 | 30 |
# documentation are those of the authors and should not be |
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 |
import copy |
|
33 | 34 |
|
34 | 35 |
|
35 | 36 |
def dict_merge(a, b): |
... | ... | |
119 | 120 |
""" |
120 | 121 |
|
121 | 122 |
name_path, node_path, basename = \ |
122 |
lookup_path(container, path, sep=sep, createpath=False)
|
|
123 |
lookup_path(container, path, sep=sep, createpath=False) |
|
123 | 124 |
|
124 | 125 |
lastnode = node_path.pop() |
125 |
lastname = basename |
|
126 | 126 |
try: |
127 | 127 |
if basename in lastnode: |
128 | 128 |
del lastnode[basename] |
... | ... | |
157 | 157 |
|
158 | 158 |
""" |
159 | 159 |
name_path, node_path, basename = \ |
160 |
lookup_path(container, path, sep=sep, createpath=False)
|
|
160 |
lookup_path(container, path, sep=sep, createpath=False) |
|
161 | 161 |
name_path.append(basename) |
162 | 162 |
node = node_path[-1] |
163 | 163 |
|
... | ... | |
186 | 186 |
Traceback (most recent call last): |
187 | 187 |
KeyError: "'a.b.x': path not found" |
188 | 188 |
>>> set_path({'a': {'b': {'c': 'd'}}}, 'a.b.x.d', 1, createpath=True) |
189 |
|
|
189 |
|
|
190 | 190 |
>>> set_path({'a': {'b': {'c': 'd'}}}, 'a.b.c', 1) |
191 |
|
|
191 |
|
|
192 | 192 |
>>> set_path({'a': {'b': {'c': 'd'}}}, 'a.b.c', 1, overwrite=False) |
193 | 193 |
Traceback (most recent call last): |
194 | 194 |
ValueError: will not overwrite path 'a.b.c' |
195 | 195 |
|
196 | 196 |
""" |
197 | 197 |
name_path, node_path, basename = \ |
198 |
lookup_path(container, path, sep=sep, createpath=createpath)
|
|
198 |
lookup_path(container, path, sep=sep, createpath=createpath) |
|
199 | 199 |
name_path.append(basename) |
200 | 200 |
node = node_path[-1] |
201 | 201 |
|
b/astakosclient/astakosclient/services.py | ||
---|---|---|
49 | 49 |
'service_type': "account", |
50 | 50 |
'service_origin': "astakos_account", |
51 | 51 |
'allow_in_projects': False}, |
52 |
}, |
|
53 | 52 |
}, |
53 |
}, |
|
54 | 54 |
|
55 | 55 |
'astakos_identity': { |
56 | 56 |
'type': 'identity', |
b/astakosclient/astakosclient/tests.py | ||
---|---|---|
1046 | 1046 |
global token_1, commission_description |
1047 | 1047 |
_mock_request([_request_ok]) |
1048 | 1048 |
try: |
1049 |
client = \
|
|
1050 |
AstakosClient("https://example.com", use_pool=True, pool_size=2)
|
|
1049 |
client = AstakosClient("https://example.com", use_pool=True,
|
|
1050 |
pool_size=2)
|
|
1051 | 1051 |
response = client.get_commission_info(token_1, 57) |
1052 | 1052 |
except Exception as err: |
1053 | 1053 |
self.fail("Shouldn't raise Exception %s" % err) |
... | ... | |
1142 | 1142 |
_mock_request([_request_ok]) |
1143 | 1143 |
try: |
1144 | 1144 |
client = AstakosClient("https://example.com") |
1145 |
result = client.resolve_commissions(token_1, [56, 57], [56, 58, 59]) |
|
1145 |
result = client.resolve_commissions(token_1, [56, 57], |
|
1146 |
[56, 58, 59]) |
|
1146 | 1147 |
except Exception as err: |
1147 | 1148 |
self.fail("Shouldn't raise Exception %s" % err) |
1148 | 1149 |
self.assertEqual(result, resolve_commissions_rep) |
Also available in: Unified diff