1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/aws/requests/storage/bucket_tests.rb

47 lines
1.1 KiB
Ruby
Raw Normal View History

Shindo.tests('AWS::Storage | bucket requests', ['aws']) do
tests('success') do
@buckets_format = {
'CreationDate' => Time,
'Name' => String,
'Owner' => {
'DisplayName' => String,
'ID' => String
}
}
tests("#put_bucket('fog_bucket')").succeeds do
AWS[:storage].put_bucket('fog_bucket')
end
tests("#get_service").formats('Buckets' => [@bucket_format]) do
AWS[:storage].get_service.body
end
tests("#delete_bucket('fog_bucket')").succeeds do
AWS[:storage].delete_bucket('fog_bucket')
end
end
tests('failure') do
tests("#delete_bucket('fog_not_a_bucket')").raises(Fog::Errors::NotFound) do
AWS[:storage].delete_bucket('fog_not_a_bucket')
end
@bucket = AWS[:storage].directories.create('fog_nonempty')
@file = @bucket.files.create(:key => 'foo', :body => 'bar')
tests("#delete_bucket('fog_nonempty')").raises(Fog::Errors::Conflict) do
AWS[:storage].delete_bucket('fog_nonempty')
end
@file.destroy
@bucket.destroy
end
end