Merge "fix(wsgi): patching claims only requires "ttl""

This commit is contained in:
Jenkins 2013-07-15 15:26:18 +00:00 committed by Gerrit Code Review
commit cb68d06e33
2 changed files with 8 additions and 7 deletions

View File

@ -102,8 +102,8 @@ class ClaimsBaseTest(base.TestBase):
self.assertEquals(self.srmock.status, falcon.HTTP_404) self.assertEquals(self.srmock.status, falcon.HTTP_404)
# Update the claim # Update the claim
new_claim = '{"ttl": 60, "grace": 60}' new_claim_ttl = '{"ttl": 60}'
self.simulate_patch(claim_href, self.project_id, body=new_claim) self.simulate_patch(claim_href, self.project_id, body=new_claim_ttl)
self.assertEquals(self.srmock.status, falcon.HTTP_204) self.assertEquals(self.srmock.status, falcon.HTTP_204)
# Get the claimed messages (again) # Get the claimed messages (again)
@ -180,8 +180,8 @@ class ClaimsFaultyDriverTests(base.TestBaseFaulty):
self.simulate_get(claims_path + '/nichts', project_id) self.simulate_get(claims_path + '/nichts', project_id)
self.assertEquals(self.srmock.status, falcon.HTTP_503) self.assertEquals(self.srmock.status, falcon.HTTP_503)
self.simulate_patch(claims_path, project_id, body=doc) self.simulate_patch(claims_path + '/nichts', project_id, body=doc)
self.assertEquals(self.srmock.status, falcon.HTTP_405) self.assertEquals(self.srmock.status, falcon.HTTP_503)
self.simulate_delete(claims_path + '/foo', project_id) self.simulate_delete(claims_path + '/foo', project_id)
self.assertEquals(self.srmock.status, falcon.HTTP_503) self.assertEquals(self.srmock.status, falcon.HTTP_503)

View File

@ -23,7 +23,8 @@ from marconi.transport.wsgi import helpers as wsgi_helpers
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
CLAIM_METADATA_SPEC = (('ttl', int), ('grace', int)) CLAIM_POST_SPEC = (('ttl', int), ('grace', int))
CLAIM_PATCH_SPEC = (('ttl', int),)
class CollectionResource(object): class CollectionResource(object):
@ -41,7 +42,7 @@ class CollectionResource(object):
# Read claim metadata (e.g., TTL) and raise appropriate # Read claim metadata (e.g., TTL) and raise appropriate
# HTTP errors as needed. # HTTP errors as needed.
metadata, = wsgi_helpers.filter_stream(req.stream, req.content_length, metadata, = wsgi_helpers.filter_stream(req.stream, req.content_length,
CLAIM_METADATA_SPEC) CLAIM_POST_SPEC)
# Claim some messages # Claim some messages
try: try:
@ -121,7 +122,7 @@ class ItemResource(object):
# Read claim metadata (e.g., TTL) and raise appropriate # Read claim metadata (e.g., TTL) and raise appropriate
# HTTP errors as needed. # HTTP errors as needed.
metadata, = wsgi_helpers.filter_stream(req.stream, req.content_length, metadata, = wsgi_helpers.filter_stream(req.stream, req.content_length,
CLAIM_METADATA_SPEC) CLAIM_PATCH_SPEC)
try: try:
self.claim_controller.update(queue_name, self.claim_controller.update(queue_name,