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:
parent
4aae5af040
commit
79eadc437e
1 changed files with 16 additions and 0 deletions
|
@ -22,6 +22,22 @@ module Fog
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue