Merge "fix: Claim can return 404"

This commit is contained in:
Jenkins 2013-09-05 12:13:29 +00:00 committed by Gerrit Code Review
commit 380e33c223
4 changed files with 6 additions and 9 deletions

View File

@ -118,9 +118,6 @@ class ClaimController(storage.ClaimBase):
"""
msg_ctrl = self.driver.message_controller
if not self.driver.queue_controller.exists(queue, project):
raise exceptions.QueueDoesNotExist(queue, project)
ttl = metadata['ttl']
grace = metadata['grace']
oid = objectid.ObjectId()
@ -148,7 +145,7 @@ class ClaimController(storage.ClaimBase):
ids = [msg['_id'] for msg in msgs]
if len(ids) == 0:
return (str(oid), messages)
return (None, messages)
now = timeutils.utcnow()

View File

@ -78,7 +78,10 @@ class ClaimController(base.ClaimBase):
project = ''
with self.driver('immediate'):
qid = utils.get_qid(self.driver, queue, project)
try:
qid = utils.get_qid(self.driver, queue, project)
except exceptions.QueueDoesNotExist:
return None, iter([])
# Clean up all expired claims in this queue

View File

@ -205,7 +205,7 @@ class ClaimsBaseTest(base.TestBase):
def test_nonexistent(self):
self.simulate_post('/v1/queues/nonexistent/claims', self.project_id,
body='{"ttl": 100, "grace": 60}')
self.assertEquals(self.srmock.status, falcon.HTTP_404)
self.assertEquals(self.srmock.status, falcon.HTTP_204)
# NOTE(cpp-cabrera): regression test against bug #1203842
def test_get_nonexistent_claim_404s(self):

View File

@ -76,9 +76,6 @@ class CollectionResource(object):
except input_exceptions.ValidationFailed as ex:
raise wsgi_exceptions.HTTPBadRequestBody(str(ex))
except storage_exceptions.DoesNotExist:
raise falcon.HTTPNotFound()
except Exception as ex:
LOG.exception(ex)
description = _(u'Claim could not be created.')