mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|storage|test] Added failing request test for delete_object with versioning.
This commit is contained in:
parent
590ae9c67b
commit
69bdbe00b8
2 changed files with 54 additions and 2 deletions
48
tests/aws/models/storage/directory_test.rb
Normal file
48
tests/aws/models/storage/directory_test.rb
Normal file
|
@ -0,0 +1,48 @@
|
|||
Fog.mock!
|
||||
|
||||
Shindo.tests("Storage[aws] | directory", [:aws]) do
|
||||
|
||||
directory_attributes = {
|
||||
:key => 'fogdirectorytests'
|
||||
}
|
||||
|
||||
model_tests(Fog::Storage[:aws].directories, directory_attributes, true) do
|
||||
|
||||
tests("#versioning=") do
|
||||
tests("#versioning=(true)").succeeds do
|
||||
@instance.versioning = true
|
||||
end
|
||||
|
||||
tests("#versioning=(true) sets versioning to 'Enabled'").returns('Enabled') do
|
||||
@instance.versioning = true
|
||||
@instance.connection.get_bucket_versioning(@instance.key).body['VersioningConfiguration']['Status']
|
||||
end
|
||||
|
||||
tests("#versioning=(false)").succeeds do
|
||||
@instance.versioning = false
|
||||
end
|
||||
|
||||
tests("#versioning=(false) sets versioning to 'Suspended'").returns('Suspended') do
|
||||
@instance.versioning = false
|
||||
@instance.connection.get_bucket_versioning(@instance.key).body['VersioningConfiguration']['Status']
|
||||
end
|
||||
end
|
||||
|
||||
tests("#versioning?") do
|
||||
tests("#versioning? false if not enabled").returns(false) do
|
||||
@instance.versioning?
|
||||
end
|
||||
|
||||
tests("#versioning? true if enabled").returns(true) do
|
||||
@instance.connection.put_bucket_versioning(@instance.key, 'Enabled')
|
||||
@instance.versioning?
|
||||
end
|
||||
|
||||
tests("#versioning? false if suspended").returns(false) do
|
||||
@instance.connection.put_bucket_versioning(@instance.key, 'Suspended')
|
||||
@instance.versioning?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -200,8 +200,12 @@ Shindo.tests('Fog::Storage[:aws] | versioning', [:aws]) do
|
|||
|
||||
file = Fog::Storage[:aws].directories.get(@aws_bucket_name).files.create(:body => 'y', :key => 'x')
|
||||
|
||||
tests("#get_object('#{@aws_bucket_name}', 'x', 'versionId' => 'bad_version'").raises(Excon::Errors::BadRequest) do
|
||||
Fog::Storage[:aws].get_object(@aws_bucket_name, 'x', 'versionId' => '-1')
|
||||
tests("#get_object('#{@aws_bucket_name}', '#{file.key}', 'versionId' => 'bad_version'").raises(Excon::Errors::BadRequest) do
|
||||
Fog::Storage[:aws].get_object(@aws_bucket_name, file.key, 'versionId' => '-1')
|
||||
end
|
||||
|
||||
tests("#delete_object('#{@aws_bucket_name}', '#{file.key}', 'versionId' => 'bad_version'").raises(Excon::Errors::BadRequest) do
|
||||
Fog::Storage[:aws].delete_object(@aws_bucket_name, file.key, 'versionId' => '-1')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue