mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Make the delete_message mock consistent.
The real API currently silently fails `delete_message` requests if the claim_id is incorrect. Make the mock API do the same thing, for consistency.
This commit is contained in:
parent
304cacd174
commit
8997b18fcc
2 changed files with 10 additions and 4 deletions
|
@ -208,6 +208,7 @@ module Fog
|
|||
# plus the claim's grace period.
|
||||
def extend_life
|
||||
return unless @claim
|
||||
# FIXME: make sure this is an *increase*
|
||||
@ttl = claim.message_end_of_life - @created
|
||||
end
|
||||
|
||||
|
|
|
@ -38,17 +38,22 @@ module Fog
|
|||
|
||||
message = queue.messages.detect { |m| m.id == message_id }
|
||||
|
||||
perform_delete = true
|
||||
if message && message.claimed?
|
||||
unless message.claim.id == claim_id
|
||||
# FIXME Exception
|
||||
# Currently returns a 204 without deleting!
|
||||
perform_delete = false
|
||||
end
|
||||
else
|
||||
unless claim_id
|
||||
# Currently succeeds.
|
||||
if claim_id
|
||||
# Currently returns a 204 without deleting!
|
||||
perform_delete = false
|
||||
end
|
||||
end
|
||||
|
||||
queue.messages.reject! { |m| m.id == message_id }
|
||||
if perform_delete
|
||||
queue.messages.reject! { |m| m.id == message_id }
|
||||
end
|
||||
|
||||
response = Excon::Response.new
|
||||
response.status = 204
|
||||
|
|
Loading…
Reference in a new issue