2013-07-19 09:42:59 -07:00
|
|
|
Shindo.tests('Fog::Rackspace::Monitoring | entity_tests', ['rackspace','rackspace_monitoring']) do
|
2013-08-29 10:50:20 -05:00
|
|
|
|
2013-07-11 15:30:37 -07: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"]
|
2013-07-15 10:48:34 -07:00
|
|
|
response
|
2013-07-11 15:30:37 -07:00
|
|
|
end
|
2013-07-26 10:06:17 -07:00
|
|
|
tests('#get entity').formats(LIST_HEADERS_FORMAT) do
|
2013-08-29 11:58:06 -05:00
|
|
|
account.get_entity(:entity_id => "fooid")
|
2013-07-26 10:06:17 -07:00
|
|
|
end
|
2013-07-11 15:30:37 -07:00
|
|
|
tests('#update entity').formats(DATA_FORMAT) do
|
2013-08-29 10:50:20 -05:00
|
|
|
pending if Fog.mocking?
|
2013-07-11 15:30:37 -07:00
|
|
|
options = { :testing => "Bar"}
|
2013-07-15 10:48:34 -07:00
|
|
|
account.update_entity(entity_id,options).data
|
2013-07-11 15:30:37 -07:00
|
|
|
end
|
|
|
|
tests('#delete entity').formats(DELETE_DATA_FORMAT) do
|
2013-07-15 10:48:34 -07:00
|
|
|
account.delete_entity(entity_id).data
|
2013-07-11 15:30:37 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
tests('failure') do
|
|
|
|
tests('#create new entity(-1)').raises(Fog::Rackspace::Monitoring::BadRequest) do
|
2013-07-11 16:46:35 -07:00
|
|
|
account.create_entity(:label => "")
|
2013-07-11 15:30:37 -07:00
|
|
|
end
|
2013-07-26 10:06:17 -07:00
|
|
|
tests('#get entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
|
|
|
|
account.get_entity(-1)
|
|
|
|
end
|
2013-07-11 16:46:35 -07:00
|
|
|
tests('#update invalid entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
|
2013-08-29 10:50:20 -05:00
|
|
|
pending if Fog.mocking?
|
2013-07-11 15:30:37 -07:00
|
|
|
options = { :testing => "Bar" }
|
2013-07-11 16:46:35 -07:00
|
|
|
response = account.update_entity(-1,options)
|
2013-07-11 15:30:37 -07:00
|
|
|
end
|
|
|
|
tests('#delete entity(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
|
|
|
|
account.delete_entity(-1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|