Commit 99895b3a authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

astakosclient: Change provisions argument to dict

parent 3605cf6a
......@@ -402,9 +402,7 @@ class AstakosClient():
request["name"] = name
try:
request["provisions"] = []
for p in provisions:
resource = p[0]
quantity = p[1]
for resource, quantity in provisions.iteritems():
t = {"holder": holder, "source": source,
"resource": resource, "quantity": quantity}
request["provisions"].append(t)
......
......@@ -954,7 +954,7 @@ class TestCommissions(unittest.TestCase):
client = AstakosClient("https://example.com")
response = client.issue_one_commission(
token_1, "c02f315b-7d84-45bc-a383-552a3f97d2ad",
"system", [("cyclades.vm", 1), ("cyclades.ram", 30000)])
"system", {"cyclades.vm": 1, "cyclades.ram": 30000})
except Exception as err:
self.fail("Shouldn't have raised Exception %s" % err)
self.assertEqual(response, commission_successful_response['serial'])
......
......@@ -143,7 +143,7 @@ retry=0, use_pool=False, pool_size=8, logger=None\ **)**
**issue_one_commission(**\ token, holder, source, provisions, name="", force=False, auto_accept=False\ **)**
Given a service's authentication token issue a commission.
In this case we specify the holder, the source and the provisions
(a list of (string, int)) and astakosclient will create the
(a dict from string to int) and astakosclient will create the
corresponding commission.
In case of success return commission's id (int).
Otherwise raise an AstakosClientException exception.
......
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