Send claims limit
as a query param
The limit argument, as specified by the API, should be a query parameter. The current client version is sending it as part of the claims' creation body. Change-Id: Id068795dc87d7380151e27de29b96597a76dd602 Closes-bug: #1489870
This commit is contained in:
parent
baf6fa7eb8
commit
2490ed44bd
@ -356,6 +356,10 @@ def claim_create(transport, request, queue_name, **kwargs):
|
||||
|
||||
request.operation = 'claim_create'
|
||||
request.params['queue_name'] = queue_name
|
||||
|
||||
if 'limit' in kwargs:
|
||||
request.params['limit'] = kwargs.pop('limit')
|
||||
|
||||
request.content = json.dumps(kwargs)
|
||||
|
||||
resp = transport.send(request)
|
||||
|
@ -51,6 +51,20 @@ class QueueV1ClaimUnitTest(base.QueuesTestBase):
|
||||
self.assertEqual(result[num]['href'], msg.href)
|
||||
self.assertEqual(len(result), num_tested)
|
||||
|
||||
def test_claim_limit(self):
|
||||
def verify_limit(request):
|
||||
self.assertIn('limit', request.params)
|
||||
self.assertEqual(request.params['limit'], 10)
|
||||
# NOTE(flaper87): We don't care about the response here,
|
||||
# fake it.
|
||||
return response.Response(None, "{0: [], 'messages': []}")
|
||||
|
||||
with mock.patch.object(self.transport, 'send',
|
||||
autospec=True) as send_method:
|
||||
|
||||
send_method.side_effect = verify_limit
|
||||
self.queue.claim(ttl=60, grace=60, limit=10)
|
||||
|
||||
def test_claim_get_by_id(self):
|
||||
result = {
|
||||
'href': '/v1/queues/fizbit/messages/50b68a50d6cb01?claim_id=4524',
|
||||
|
Loading…
Reference in New Issue
Block a user