1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws|storage|test] Fixed a regression with mocked get_bucket requests, due to a change in the mock data ordering.

This commit is contained in:
Kevin Menard 2012-02-08 12:39:14 -05:00
parent d5678ee86a
commit d4c61c8190
2 changed files with 17 additions and 1 deletions

View file

@ -69,7 +69,7 @@ module Fog
end
response = Excon::Response.new
if bucket = self.data[:buckets][bucket_name]
contents = bucket[:objects].values.collect(&:last).sort {|x,y| x['Key'] <=> y['Key']}.reject do |object|
contents = bucket[:objects].values.collect(&:first).sort {|x,y| x['Key'] <=> y['Key']}.reject do |object|
(prefix && object['Key'][0...prefix.length] != prefix) ||
(marker && object['Key'] <= marker) ||
(delimiter && object['Key'][(prefix ? prefix.length : 0)..-1].include?(delimiter) \

View file

@ -134,6 +134,22 @@ Shindo.tests('Fog::Storage[:aws] | versioning', [:aws]) do
end
end
tests("get_bucket('#{@aws_bucket_name}'") do
clear_bucket
file = Fog::Storage[:aws].directories.get(@aws_bucket_name).files.create(:body => 'a', :key => 'file')
tests("includes a non-DeleteMarker object").returns(1) do
Fog::Storage[:aws].get_bucket(@aws_bucket_name).body['Contents'].size
end
file.destroy
tests("does not include a DeleteMarker object").returns(0) do
Fog::Storage[:aws].get_bucket(@aws_bucket_name).body['Contents'].size
end
end
delete_bucket
end