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

[aws|storage|test] Added request tests for delete_object with versioning.

This commit is contained in:
Kevin Menard 2012-01-05 17:56:26 -05:00
parent 002d6e4dc5
commit 590ae9c67b

View file

@ -150,6 +150,32 @@ Shindo.tests('Fog::Storage[:aws] | versioning', [:aws]) do
end
end
tests("delete_object('#{@aws_bucket_name}', 'file')") do
clear_bucket
file = Fog::Storage[:aws].directories.get(@aws_bucket_name).files.create(:body => 'a', :key => 'file')
tests("deleting an object just stores a delete marker").returns(true) do
file.destroy
versions = Fog::Storage[:aws].get_bucket_object_versions(@aws_bucket_name)
versions.body['Versions'].first.has_key?('DeleteMarker')
end
tests("there are two versions: the original and the delete marker").returns(2) do
versions = Fog::Storage[:aws].get_bucket_object_versions(@aws_bucket_name)
versions.body['Versions'].size
end
tests("deleting the delete marker makes the object available again").returns(file.version) do
versions = Fog::Storage[:aws].get_bucket_object_versions(@aws_bucket_name)
delete_marker = versions.body['Versions'].find { |v| v.has_key?('DeleteMarker') }
Fog::Storage[:aws].delete_object(@aws_bucket_name, file.key, 'versionId' => delete_marker['DeleteMarker']['VersionId'])
res = Fog::Storage[:aws].get_object(@aws_bucket_name, file.key)
res.headers['x-amz-version-id']
end
end
delete_bucket
end