deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dko...@apache.org
Subject [2/2] git commit: Mock: Raise NotFound when instance does not exists when creating the Image
Date Mon, 01 Jul 2013 08:42:20 GMT
Mock: Raise NotFound when instance does not exists when creating the Image


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/a4a18cd8
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/a4a18cd8
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/a4a18cd8

Branch: refs/heads/master
Commit: a4a18cd81d36c226ba880260c4509c9161909937
Parents: 034eef2
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Tue Jun 18 13:15:33 2013 +0200
Committer: Dies Koper <diesk@fast.au.fujitsu.com>
Committed: Mon Jul 1 18:41:54 2013 +1000

----------------------------------------------------------------------
 server/lib/deltacloud/drivers/mock/mock_driver.rb | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a4a18cd8/server/lib/deltacloud/drivers/mock/mock_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb b/server/lib/deltacloud/drivers/mock/mock_driver.rb
index 0688ae6..5b76c47 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
@@ -145,7 +145,8 @@ module Deltacloud::Drivers::Mock
       instance = instance(credentials, opts)
 
       safely do
-        raise 'CreateImageNotSupported' unless instance and instance.can_create_image?
+        raise 'NotFound' unless instance
+        raise 'CreateImageNotSupported' unless instance.can_create_image?
         image = {
           :id => opts[:name],
           :name => opts[:name],
@@ -727,6 +728,10 @@ module Deltacloud::Drivers::Mock
         message "Authentication Failure"
       end
 
+      on /CreateImageNotSupported/ do
+        status 500
+      end
+
       on /BucketNotEmpty/ do
         status 403
         message "Delete operation not valid for non-empty bucket"
@@ -745,14 +750,10 @@ module Deltacloud::Drivers::Mock
         status 403
       end
 
-      on /(BucketNotExist || NotFound)/ do
+      on /(BucketNotExist|NotFound)/ do
         status 404
       end
 
-      on /CreateImageNotSupported/ do
-        status 500
-      end
-
       on /NotExistentBlob/ do
         status 500
         message "Could not delete a non existent blob"


Mime
View raw message