deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/6] git commit: Mock: Respond 404 when deleting non-existing bucket
Date Tue, 20 Mar 2012 14:37:48 GMT
Updated Branches:
  refs/heads/master 5483a9545 -> 4a3fc20bb


Mock: Respond 404 when deleting non-existing bucket


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

Branch: refs/heads/master
Commit: 8b65b0954bd5b4530cb52d71f7b3e299883b102a
Parents: 0e67b71
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Tue Mar 20 14:23:20 2012 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue Mar 20 15:38:35 2012 +0100

----------------------------------------------------------------------
 server/lib/deltacloud/drivers/mock/mock_driver.rb |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/8b65b095/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 67b4990..d8882db 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
@@ -365,7 +365,8 @@ module Deltacloud::Drivers::Mock
     def delete_bucket(credentials, name, opts={})
       check_credentials(credentials)
       bucket = bucket(credentials, {:id => name})
-      raise "BucketNotEmpty" unless (bucket.size == "0")
+      raise 'BucketNotExist' if bucket.nil?
+      raise "BucketNotEmpty" unless (bucket and bucket.size == "0")
       @client.destroy(:buckets, bucket.id)
     end
 
@@ -385,7 +386,7 @@ module Deltacloud::Drivers::Mock
     def blob_data(credentials, bucket_id, blob_id, opts = {})
       check_credentials(credentials)
       if blob = @client.load(:blobs, blob_id)
-        blob[:content].each {|part| yield part}
+        blob[:content].split('').each {|part| yield part}
       end
     end
 
@@ -507,6 +508,10 @@ module Deltacloud::Drivers::Mock
         message "Key with same name already exists"
       end
 
+      on /BucketNotExist/ do
+        status 404
+      end
+
       on /CreateImageNotSupported/ do
         status 500
       end


Mime
View raw message