1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/rackspace/requests/monitoring/entity_tests.rb

40 lines
1.4 KiB
Ruby
Raw Normal View History

Shindo.tests('Fog::Rackspace::Monitoring | entity_tests', ['rackspace','rackspace_monitoring']) do
2013-08-29 10:50:20 -05:00
account = Fog::Rackspace::Monitoring.new
entity_id = nil
tests('success') do
tests('#create new entity').formats(DATA_FORMAT) do
response = account.create_entity(:label => "Foo").data
entity_id = response[:headers]["X-Object-ID"]
response
end
tests('#get entity').formats(LIST_HEADERS_FORMAT) do
2013-08-29 11:58:06 -05:00
account.get_entity(:entity_id => "fooid")
end
tests('#update entity').formats(DATA_FORMAT) do
2013-08-29 10:50:20 -05:00
pending if Fog.mocking?
options = { :testing => "Bar"}
account.update_entity(entity_id,options).data
end
tests('#delete entity').formats(DELETE_DATA_FORMAT) do
account.delete_entity(entity_id).data
end
end
tests('failure') do
tests('#create new entity(-1)').raises(Fog::Rackspace::Monitoring::BadRequest) do
account.create_entity(:label => "")
end
tests('#get entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
account.get_entity(-1)
end
tests('#update invalid entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
2013-08-29 10:50:20 -05:00
pending if Fog.mocking?
options = { :testing => "Bar" }
response = account.update_entity(-1,options)
end
tests('#delete entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
account.delete_entity(-1)
end
end
end