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

Add mocking support.

This commit is contained in:
Rupak Ganguly 2012-04-04 19:35:31 -04:00
parent 4aae5af040
commit 79eadc437e

View file

@ -22,6 +22,22 @@ module Fog
end end
end end
class Mock
def get_image_details(image_id)
response = Excon::Response.new
if image = list_images_detail.body['images'].detect {|_| _['id'] == image_id}
response.status = [200, 203][rand(1)]
response.body = { 'image' => image }
response
else
raise Fog::Compute::HP::NotFound
end
end
end
end end
end end
end end