mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Now catching errors correctly, all tests succeed
This commit is contained in:
parent
002a918b21
commit
42e1b7604d
2 changed files with 8 additions and 14 deletions
|
@ -139,11 +139,15 @@ module Fog
|
|||
rescue Excon::Errors::HTTPStatusError => error
|
||||
raise case error
|
||||
when Excon::Errors::NotFound
|
||||
Fog::Rackspace::Monitoring::NotFound.slurp(error)
|
||||
Fog::Rackspace::Monitoring::NotFound.slurp error
|
||||
else
|
||||
error
|
||||
end
|
||||
end
|
||||
rescue Excon::Errors::BadRequest => error
|
||||
raise BadRequest.slurp error
|
||||
rescue Excon::Errors::NotFound
|
||||
raise NotFound.slurp error
|
||||
unless response.body.empty?
|
||||
response.body = JSON.decode(response.body)
|
||||
end
|
||||
|
|
|
@ -20,23 +20,13 @@ Shindo.tests('Fog::Rackspace::Monitoring | entity_tests', ['rackspace','rackspac
|
|||
response[:status] == 204 ? response : false
|
||||
end
|
||||
end
|
||||
end
|
||||
__END__
|
||||
tests('failure') do
|
||||
tests('#create new entity(-1)').raises(Fog::Rackspace::Monitoring::BadRequest) do
|
||||
response = account.create_entity(:label => "").data
|
||||
puts "I made it this far"
|
||||
pp response
|
||||
puts "All done now"
|
||||
account.create_entity(:label => "")
|
||||
end
|
||||
tests('#update entity(-1)').raises(Fog::Rackspace::Monitoring::Notfound) do
|
||||
entity_id = account.create_entity(:label => "Foo").data[:headers]["X-Object-ID"] #setup
|
||||
tests('#update invalid entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
|
||||
options = { :testing => "Bar" }
|
||||
response = account.update_entity(entity_id,options)
|
||||
puts ""
|
||||
pp response
|
||||
account.delete_entity(entity_id) #cleanup
|
||||
response
|
||||
response = account.update_entity(-1,options)
|
||||
end
|
||||
tests('#delete entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
|
||||
account.delete_entity(-1)
|
||||
|
|
Loading…
Reference in a new issue