From 79eadc437e224bca435246a73391d6dc5fdb0ec4 Mon Sep 17 00:00:00 2001 From: Rupak Ganguly Date: Wed, 4 Apr 2012 19:35:31 -0400 Subject: [PATCH] Add mocking support. --- lib/fog/hp/requests/compute/get_image_details.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/fog/hp/requests/compute/get_image_details.rb b/lib/fog/hp/requests/compute/get_image_details.rb index 328dab6bf..e1b264aef 100644 --- a/lib/fog/hp/requests/compute/get_image_details.rb +++ b/lib/fog/hp/requests/compute/get_image_details.rb @@ -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