Permalink
Browse files

Fix Bucket Deletion and Hashing

  • Loading branch information...
1 parent 95b0c74 commit da366eb90c09420dac1713bd7fe60bd9ea63180b @jubos committed Apr 17, 2012
Showing with 15 additions and 3 deletions.
  1. +1 −1 lib/fakes3/file_store.rb
  2. +8 −0 lib/fakes3/s3_object.rb
  3. +4 −1 test/s3_commands_test.rb
  4. +2 −1 test/s3cmd_test.rb
View
@@ -66,7 +66,7 @@ def delete_bucket(bucket_name)
bucket = get_bucket(bucket_name)
raise NoSuchBucket if !bucket
raise BucketNotEmpty if bucket.objects.count > 0
- FileUtils.rm_f(get_bucket_folder(bucket))
+ FileUtils.rm_r(get_bucket_folder(bucket))
@bucket_hash.delete(bucket_name)
end
View
@@ -3,6 +3,14 @@ class S3Object
include Comparable
attr_accessor :name,:size,:creation_date,:md5,:io,:content_type
+ def hash
+ @name.hash
+ end
+
+ def eql?(object)
+ @name == object.name
+ end
+
# Sort by the object's name
def <=>(object)
@name <=> object.name
View
@@ -7,7 +7,10 @@ class S3CommandsTest < Test::Unit::TestCase
include AWS::S3
def setup
- AWS::S3::Base.establish_connection!(:access_key_id => "123", :secret_access_key => "abc", :server => "localhost", :port => "10453" )
+ AWS::S3::Base.establish_connection!(:access_key_id => "123",
+ :secret_access_key => "abc",
+ :server => "localhost",
+ :port => "10453" )
end
def teardown
View
@@ -1,8 +1,9 @@
require 'test/test_helper'
require 'fileutils'
-#require 'fakes3/server'
# You need to have s3cmd installed to use this
+# Also, s3cmd doesn't support path style requests, so in order to properly test
+# it you need to modify your dns by changing /etc/hosts or using dnsmasq
class S3CmdTest < Test::Unit::TestCase
def setup

0 comments on commit da366eb

Please sign in to comment.