1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

delete_alarm mock support

This commit is contained in:
Ryan Richard 2013-08-30 11:53:53 -05:00
parent bc7d1a5d5b
commit ba8060af80
2 changed files with 15 additions and 4 deletions

View file

@ -16,13 +16,26 @@ module Fog
def delete_alarm(entity_id, alarm_id) def delete_alarm(entity_id, alarm_id)
if entity_id == -1 || alarm_id == -1
raise Fog::Rackspace::Monitoring::NotFound
end
response = Excon::Response.new response = Excon::Response.new
response.status = 204 response.status = 204
response.body = "" response.body = ""
response.headers = { response.headers = {
"Date" => Time.now.utc.to_s,
"Content-Type" => "application/json; charset=UTF-8",
"X-RateLimit-Limit" => "50000",
"X-RateLimit-Remaining" => "38687",
"X-RateLimit-Window" => "24 hours",
"X-RateLimit-Type" => "global",
"X-Response-Id" => "pomsbnio93gm3030fm303.mmowd",
"X-LB" => "ord1-maas-prod-api0",
"Vary" => "Accept-Encoding",
"Content-Length" => "0"
} }
response.remote_ip = Fog::Rackspace::MockData.ipv4_address
response response
end end
end end

View file

@ -29,7 +29,6 @@ Shindo.tests('Fog::Rackspace::Monitoring | alarm_tests', ['rackspace','rackspace
account.get_alarm(entity_id,alarm_id).data[:headers] account.get_alarm(entity_id,alarm_id).data[:headers]
end end
tests('#delete alarm').formats(DELETE_DATA_FORMAT) do tests('#delete alarm').formats(DELETE_DATA_FORMAT) do
pending if Fog.mocking?
account.delete_alarm(entity_id,alarm_id).data account.delete_alarm(entity_id,alarm_id).data
end end
end end
@ -48,7 +47,6 @@ Shindo.tests('Fog::Rackspace::Monitoring | alarm_tests', ['rackspace','rackspace
account.get_alarm(-1,-1) account.get_alarm(-1,-1)
end end
tests('#fail to delete alarm(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do tests('#fail to delete alarm(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
pending if Fog.mocking?
account.delete_alarm(-1,-1) account.delete_alarm(-1,-1)
end end
end end