Commit 369218ef authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

quotaholder: Ignore force option when releasing

Since negative usage makes no sense, we always check this lower
boundary when issuing a commission.
parent 1e62c0b6
......@@ -1917,7 +1917,21 @@ class QuotaAPITest(TestCase):
r = client.post(u('commissions'), post_data,
content_type='application/json', **s1_headers)
self.assertEqual(r.status_code, 201)
body = json.loads(r.content)
commission_request = {
"force": True,
"provisions": [
{
"holder": user.uuid,
"source": "system",
"resource": resource11['name'],
"quantity": -200
}]}
post_data = json.dumps(commission_request)
r = client.post(u('commissions'), post_data,
content_type='application/json', **s1_headers)
self.assertEqual(r.status_code, 413)
r = client.get(u('quotas'), **headers)
self.assertEqual(r.status_code, 200)
......
......@@ -155,7 +155,7 @@ def issue_commission(clientkey, provisions, name="", force=False):
else: # release
abs_quantity = -quantity
operations.prepare(Release, th, abs_quantity, force)
operations.prepare(Release, th, abs_quantity, False)
holdings[key] = th
provisions_to_create.append((key, quantity))
......
......@@ -70,7 +70,7 @@ class QuotaholderTest(TestCase):
r = qh.get_quota()
self.assertEqual(r, {(holder, source, resource1): (limit2, 0, 0)})
# issueing commissions
# issuing commissions
qh.set_quota([((holder, source, resource1), limit1),
((holder, source, resource2), limit2)])
......@@ -236,6 +236,11 @@ class QuotaholderTest(TestCase):
}
self.assertEqual(r, quotas)
with assertRaises(NoQuantityError):
self.issue_commission(
[((holder, source, resource1), -2*limit1)],
force=True)
# release off upper limit
serial = self.issue_commission([((holder, source, resource1), -1)])
......
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