mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[tests] rearrange to match new lib structure
This commit is contained in:
parent
3a17ba2249
commit
fcc5a1c224
100 changed files with 0 additions and 49 deletions
|
|
@ -1,19 +0,0 @@
|
|||
Shindo.tests("Storage[:ninefold] | nested directories", ['ninefold']) do
|
||||
|
||||
unless Fog.mocking?
|
||||
@directory = Fog::Storage[:ninefold].directories.create(:key => 'updatefiletests')
|
||||
end
|
||||
|
||||
ninefold = Fog::Storage[:ninefold]
|
||||
tests("update a file").succeeds do
|
||||
pending if Fog.mocking?
|
||||
file = @directory.files.create(:key => 'lorem.txt', :body => lorem_file)
|
||||
file.body = "xxxxxx"
|
||||
file.save
|
||||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
@directory.destroy(:recursive => true)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
Shindo.tests("Storage[:ninefold] | nested directories", ['ninefold']) do
|
||||
ninefold = Fog::Storage[:ninefold]
|
||||
tests("create a directory with a / character").succeeds do
|
||||
pending if Fog.mocking?
|
||||
ninefold.directories.create(:key => 'sub/path')
|
||||
end
|
||||
|
||||
tests("List of top directory returns sub dir").returns(1) do
|
||||
pending if Fog.mocking?
|
||||
ninefold.directories.get('sub').directories.count
|
||||
end
|
||||
|
||||
tests("create a directory in a sub dir").returns('sub/path/newdir/') do
|
||||
pending if Fog.mocking?
|
||||
ninefold.directories.get('sub/path').directories.create(:key => 'newdir').identity
|
||||
end
|
||||
|
||||
tests("Recursively destroy parent dir").succeeds do
|
||||
pending if Fog.mocking?
|
||||
ninefold.directories.get('sub').destroy(:recursive => true)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,204 +0,0 @@
|
|||
Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
|
||||
|
||||
tests('success') do
|
||||
|
||||
@bucket_format = {
|
||||
'CommonPrefixes' => [],
|
||||
'IsTruncated' => Fog::Boolean,
|
||||
'Marker' => NilClass,
|
||||
'MaxKeys' => Integer,
|
||||
'Name' => String,
|
||||
'Prefix' => NilClass,
|
||||
'Contents' => [{
|
||||
'ETag' => String,
|
||||
'Key' => String,
|
||||
'LastModified' => Time,
|
||||
'Owner' => {
|
||||
'DisplayName' => String,
|
||||
'ID' => String
|
||||
},
|
||||
'Size' => Integer,
|
||||
'StorageClass' => String
|
||||
}]
|
||||
}
|
||||
|
||||
@service_format = {
|
||||
'Buckets' => [{
|
||||
'CreationDate' => Time,
|
||||
'Name' => String,
|
||||
}],
|
||||
'Owner' => {
|
||||
'DisplayName' => String,
|
||||
'ID' => String
|
||||
}
|
||||
}
|
||||
|
||||
tests("#put_bucket('fogbuckettests')").succeeds do
|
||||
Fog::Storage[:aws].put_bucket('fogbuckettests')
|
||||
end
|
||||
|
||||
tests("#get_service").formats(@service_format) do
|
||||
Fog::Storage[:aws].get_service.body
|
||||
end
|
||||
|
||||
file = Fog::Storage[:aws].directories.get('fogbuckettests').files.create(:body => 'y', :key => 'x')
|
||||
|
||||
tests("#get_bucket('fogbuckettests)").formats(@bucket_format) do
|
||||
Fog::Storage[:aws].get_bucket('fogbuckettests').body
|
||||
end
|
||||
|
||||
file.destroy
|
||||
|
||||
file1 = Fog::Storage[:aws].directories.get('fogbuckettests').files.create(:body => 'a', :key => 'a/a1/file1')
|
||||
file2 = Fog::Storage[:aws].directories.get('fogbuckettests').files.create(:body => 'ab', :key => 'a/file2')
|
||||
file3 = Fog::Storage[:aws].directories.get('fogbuckettests').files.create(:body => 'abc', :key => 'b/file3')
|
||||
file4 = Fog::Storage[:aws].directories.get('fogbuckettests').files.create(:body => 'abcd', :key => 'file4')
|
||||
|
||||
tests("#get_bucket('fogbuckettests')") do
|
||||
before do
|
||||
@bucket = Fog::Storage[:aws].get_bucket('fogbuckettests')
|
||||
end
|
||||
|
||||
tests(".body['Contents'].map{|n| n['Key']}").returns(["a/a1/file1", "a/file2", "b/file3", "file4"]) do
|
||||
@bucket.body['Contents'].map{|n| n['Key']}
|
||||
end
|
||||
|
||||
tests(".body['Contents'].map{|n| n['Size']}").returns([1, 2, 3, 4]) do
|
||||
@bucket.body['Contents'].map{|n| n['Size']}
|
||||
end
|
||||
|
||||
tests(".body['CommonPrefixes']").returns([]) do
|
||||
@bucket.body['CommonPrefixes']
|
||||
end
|
||||
end
|
||||
|
||||
tests("#get_bucket('fogbuckettests', 'delimiter' => '/')") do
|
||||
before do
|
||||
@bucket = Fog::Storage[:aws].get_bucket('fogbuckettests', 'delimiter' => '/')
|
||||
end
|
||||
|
||||
tests(".body['Contents'].map{|n| n['Key']}").returns(['file4']) do
|
||||
@bucket.body['Contents'].map{|n| n['Key']}
|
||||
end
|
||||
|
||||
tests(".body['CommonPrefixes']").returns(['a/', 'b/']) do
|
||||
@bucket.body['CommonPrefixes']
|
||||
end
|
||||
end
|
||||
|
||||
tests("#get_bucket('fogbuckettests', 'delimiter' => '/', 'prefix' => 'a/')") do
|
||||
before do
|
||||
@bucket = Fog::Storage[:aws].get_bucket('fogbuckettests', 'delimiter' => '/', 'prefix' => 'a/')
|
||||
end
|
||||
|
||||
tests(".body['Contents'].map{|n| n['Key']}").returns(['a/file2']) do
|
||||
@bucket.body['Contents'].map{|n| n['Key']}
|
||||
end
|
||||
|
||||
tests(".body['CommonPrefixes']").returns(['a/a1/']) do
|
||||
@bucket.body['CommonPrefixes']
|
||||
end
|
||||
end
|
||||
|
||||
file1.destroy; file2.destroy; file3.destroy; file4.destroy
|
||||
|
||||
tests("#get_bucket_location('fogbuckettests)").formats('LocationConstraint' => NilClass) do
|
||||
Fog::Storage[:aws].get_bucket_location('fogbuckettests').body
|
||||
end
|
||||
|
||||
tests("#get_request_payment('fogbuckettests')").formats('Payer' => String) do
|
||||
Fog::Storage[:aws].get_request_payment('fogbuckettests').body
|
||||
end
|
||||
|
||||
tests("#put_request_payment('fogbuckettests', 'Requester')").succeeds do
|
||||
Fog::Storage[:aws].put_request_payment('fogbuckettests', 'Requester')
|
||||
end
|
||||
|
||||
tests("#put_bucket_website('fogbuckettests', 'index.html')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:aws].put_bucket_website('fogbuckettests', 'index.html')
|
||||
end
|
||||
|
||||
tests("#delete_bucket_website('fogbuckettests')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:aws].delete_bucket_website('fogbuckettests')
|
||||
end
|
||||
|
||||
tests("#delete_bucket('fogbuckettests')").succeeds do
|
||||
Fog::Storage[:aws].delete_bucket('fogbuckettests')
|
||||
end
|
||||
|
||||
tests("#put_bucket_acl('fogbuckettests', 'private')").succeeds do
|
||||
Fog::Storage[:aws].put_bucket_acl('fogbuckettests', 'private')
|
||||
end
|
||||
|
||||
tests("#put_bucket_acl('fogbuckettests', hash)").returns(true) do
|
||||
Fog::Storage[:aws].put_bucket_acl('fogbuckettests', {
|
||||
'Owner' => { 'ID' => "8a6925ce4adf5f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
|
||||
'AccessControlList' => [
|
||||
{
|
||||
'Grantee' => { 'ID' => "8a6925ce4adf588a4532142d3f74dd8c71fa124b1ddee97f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
|
||||
'Permission' => "FULL_CONTROL"
|
||||
}
|
||||
]
|
||||
})
|
||||
Fog::Storage[:aws].get_bucket_acl('fogbuckettests').body == <<-BODY
|
||||
<AccessControlPolicy>
|
||||
<Owner>
|
||||
<ID>8a6925ce4adf5f21c32aa379004fef</ID>
|
||||
<DisplayName>mtd@amazon.com</DisplayName>
|
||||
</Owner>
|
||||
<AccessControlList>
|
||||
<Grant>
|
||||
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
|
||||
<ID>8a6925ce4adf588a4532142d3f74dd8c71fa124b1ddee97f21c32aa379004fef</ID>
|
||||
<DisplayName>mtd@amazon.com</DisplayName>
|
||||
</Grantee>
|
||||
<Permission>FULL_CONTROL</Permission>
|
||||
</Grant>
|
||||
</AccessControlList>
|
||||
</AccessControlPolicy>
|
||||
BODY
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("#delete_bucket('fognonbucket')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].delete_bucket('fognonbucket')
|
||||
end
|
||||
|
||||
@bucket = Fog::Storage[:aws].directories.create(:key => 'fognonempty')
|
||||
@file = @bucket.files.create(:key => 'foo', :body => 'bar')
|
||||
|
||||
tests("#delete_bucket('fognonempty')").raises(Excon::Errors::Conflict) do
|
||||
Fog::Storage[:aws].delete_bucket('fognonempty')
|
||||
end
|
||||
|
||||
@file.destroy
|
||||
@bucket.destroy
|
||||
|
||||
tests("#get_bucket('fognonbucket')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].get_bucket('fognonbucket')
|
||||
end
|
||||
|
||||
tests("#get_bucket_location('fognonbucket')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].get_bucket_location('fognonbucket')
|
||||
end
|
||||
|
||||
tests("#get_request_payment('fognonbucket')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].get_request_payment('fognonbucket')
|
||||
end
|
||||
|
||||
tests("#put_request_payment('fognonbucket', 'Requester')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].put_request_payment('fognonbucket', 'Requester')
|
||||
end
|
||||
|
||||
tests("#put_bucket_acl('fognonbucket', 'invalid')").raises(Excon::Errors::BadRequest) do
|
||||
Fog::Storage[:aws].put_bucket_acl('fognonbucket', 'invalid')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
Shindo.tests('Fog::Storage[:aws] | multipart upload requests', [:aws]) do
|
||||
|
||||
@directory = Fog::Storage[:aws].directories.create(:key => 'fogmultipartuploadtests')
|
||||
|
||||
tests('success') do
|
||||
|
||||
@initiate_multipart_upload_format = {
|
||||
'Bucket' => String,
|
||||
'Key' => String,
|
||||
'UploadId' => String
|
||||
}
|
||||
|
||||
tests("#initiate_multipart_upload('#{@directory.identity}')", 'fog_multipart_upload').formats(@initiate_multipart_upload_format) do
|
||||
pending if Fog.mocking?
|
||||
data = Fog::Storage[:aws].initiate_multipart_upload(@directory.identity, 'fog_multipart_upload').body
|
||||
@upload_id = data['UploadId']
|
||||
data
|
||||
end
|
||||
|
||||
@list_multipart_uploads_format = {
|
||||
'Bucket' => String,
|
||||
'IsTruncated' => Fog::Boolean,
|
||||
'MaxUploads' => Integer,
|
||||
'KeyMarker' => NilClass,
|
||||
'NextKeyMarker' => String,
|
||||
'NextUploadIdMarker' => Fog::Nullable::String,
|
||||
'Upload' => [{
|
||||
'Initiated' => Time,
|
||||
'Initiator' => {
|
||||
'DisplayName' => String,
|
||||
'ID' => String
|
||||
},
|
||||
'Key' => String,
|
||||
'Owner' => {
|
||||
'DisplayName' => String,
|
||||
'ID' => String
|
||||
},
|
||||
'StorageClass' => String,
|
||||
'UploadId' => String
|
||||
}],
|
||||
'UploadIdMarker' => NilClass,
|
||||
}
|
||||
|
||||
tests("#list_multipart_uploads('#{@directory.identity})").formats(@list_multipart_uploads_format) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:aws].list_multipart_uploads(@directory.identity).body
|
||||
end
|
||||
|
||||
@parts = []
|
||||
|
||||
tests("#upload_part('#{@directory.identity}', 'fog_multipart_upload', '#{@upload_id}', 1, ('x' * 6 * 1024 * 1024))").succeeds do
|
||||
pending if Fog.mocking?
|
||||
data = Fog::Storage[:aws].upload_part(@directory.identity, 'fog_multipart_upload', @upload_id, 1, ('x' * 6 * 1024 * 1024))
|
||||
@parts << data.headers['ETag']
|
||||
end
|
||||
|
||||
@list_parts_format = {
|
||||
'Bucket' => String,
|
||||
'Initiator' => {
|
||||
'DisplayName' => String,
|
||||
'ID' => String
|
||||
},
|
||||
'IsTruncated' => Fog::Boolean,
|
||||
'Key' => String,
|
||||
'MaxParts' => Integer,
|
||||
'NextPartNumberMarker' => String,
|
||||
'Part' => [{
|
||||
'ETag' => String,
|
||||
'LastModified' => Time,
|
||||
'PartNumber' => Integer,
|
||||
'Size' => Integer
|
||||
}],
|
||||
'PartNumberMarker' => String,
|
||||
'StorageClass' => String,
|
||||
'UploadId' => String
|
||||
}
|
||||
|
||||
tests("#list_parts('#{@directory.identity}', 'fog_multipart_upload', '#{@upload_id}')").formats(@list_parts_format) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:aws].list_parts(@directory.identity, 'fog_multipart_upload', @upload_id).body
|
||||
end
|
||||
|
||||
if !Fog.mocking?
|
||||
@parts << Fog::Storage[:aws].upload_part(@directory.identity, 'fog_multipart_upload', @upload_id, 2, ('x' * 4 * 1024 * 1024)).headers['ETag']
|
||||
end
|
||||
|
||||
@complete_multipart_upload_format = {
|
||||
'Bucket' => String,
|
||||
'ETag' => String,
|
||||
'Key' => String,
|
||||
'Location' => String
|
||||
}
|
||||
|
||||
tests("#complete_multipart_upload('#{@directory.identity}', 'fog_multipart_upload', '#{@upload_id}', #{@parts.inspect})").formats(@complete_multipart_upload_format) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:aws].complete_multipart_upload(@directory.identity, 'fog_multipart_upload', @upload_id, @parts).body
|
||||
end
|
||||
|
||||
tests("#get_object('#{@directory.identity}', 'fog_multipart_upload').body").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:aws].get_object(@directory.identity, 'fog_multipart_upload').body == ('x' * 10 * 1024 * 1024)
|
||||
end
|
||||
|
||||
if !Fog.mocking?
|
||||
@directory.files.new(:key => 'fog_multipart_upload').destroy
|
||||
end
|
||||
|
||||
if !Fog.mocking?
|
||||
@upload_id = Fog::Storage[:aws].initiate_multipart_upload(@directory.identity, 'fog_multipart_abort').body['UploadId']
|
||||
end
|
||||
|
||||
tests("#abort_multipart_upload('#{@directory.identity}', 'fog_multipart_abort', '#{@upload_id}')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:aws].abort_multipart_upload(@directory.identity, 'fog_multipart_abort', @upload_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("initiate_multipart_upload")
|
||||
tests("list_multipart_uploads")
|
||||
tests("upload_part")
|
||||
tests("list_parts")
|
||||
tests("complete_multipart_upload")
|
||||
tests("abort_multipart_upload")
|
||||
|
||||
end
|
||||
|
||||
@directory.destroy
|
||||
|
||||
end
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
Shindo.tests('AWS::Storage | object requests', ['aws']) do
|
||||
|
||||
@directory = Fog::Storage[:aws].directories.create(:key => 'fogobjecttests')
|
||||
|
||||
tests('success') do
|
||||
|
||||
tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file)").succeeds do
|
||||
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file)
|
||||
end
|
||||
|
||||
tests("#copy_object('#{@directory.identity}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").succeeds do
|
||||
Fog::Storage[:aws].copy_object(@directory.identity, 'fog_object', @directory.identity, 'fog_other_object')
|
||||
end
|
||||
|
||||
@directory.files.get('fog_other_object').destroy
|
||||
|
||||
tests("#get_object('#{@directory.identity}', 'fog_object')").returns(lorem_file.read) do
|
||||
Fog::Storage[:aws].get_object(@directory.identity, 'fog_object').body
|
||||
end
|
||||
|
||||
tests("#get_object('#{@directory.identity}', 'fog_object', &block)").returns(lorem_file.read) do
|
||||
data = ''
|
||||
Fog::Storage[:aws].get_object(@directory.identity, 'fog_object') do |chunk, remaining_bytes, total_bytes|
|
||||
data << chunk
|
||||
end
|
||||
data
|
||||
end
|
||||
|
||||
tests("#head_object('#{@directory.identity}', 'fog_object')").succeeds do
|
||||
Fog::Storage[:aws].head_object(@directory.identity, 'fog_object')
|
||||
end
|
||||
|
||||
tests("#put_object_acl('#{@directory.identity}', 'fog_object', 'private')").succeeds do
|
||||
Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', 'private')
|
||||
end
|
||||
|
||||
tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash)").returns(true) do
|
||||
Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', {
|
||||
'Owner' => { 'ID' => "8a6925ce4adf5f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
|
||||
'AccessControlList' => [
|
||||
{
|
||||
'Grantee' => { 'ID' => "8a6925ce4adf588a4532142d3f74dd8c71fa124b1ddee97f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
|
||||
'Permission' => "FULL_CONTROL"
|
||||
}
|
||||
]})
|
||||
Fog::Storage[:aws].get_object_acl(@directory.identity, 'fog_object').body == <<-BODY
|
||||
<AccessControlPolicy>
|
||||
<Owner>
|
||||
<ID>8a6925ce4adf5f21c32aa379004fef</ID>
|
||||
<DisplayName>mtd@amazon.com</DisplayName>
|
||||
</Owner>
|
||||
<AccessControlList>
|
||||
<Grant>
|
||||
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
|
||||
<ID>8a6925ce4adf588a4532142d3f74dd8c71fa124b1ddee97f21c32aa379004fef</ID>
|
||||
<DisplayName>mtd@amazon.com</DisplayName>
|
||||
</Grantee>
|
||||
<Permission>FULL_CONTROL</Permission>
|
||||
</Grant>
|
||||
</AccessControlList>
|
||||
</AccessControlPolicy>
|
||||
BODY
|
||||
end
|
||||
|
||||
tests("#delete_object('#{@directory.identity}', 'fog_object')").succeeds do
|
||||
Fog::Storage[:aws].delete_object(@directory.identity, 'fog_object')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("#put_object('fognonbucket', 'fog_non_object', lorem_file)").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].put_object('fognonbucket', 'fog_non_object', lorem_file)
|
||||
end
|
||||
|
||||
tests("#copy_object('fognonbucket', 'fog_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].copy_object('fognonbucket', 'fog_object', @directory.identity, 'fog_other_object')
|
||||
end
|
||||
|
||||
tests("#copy_object('#{@directory.identity}', 'fog_non_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].copy_object(@directory.identity, 'fog_non_object', @directory.identity, 'fog_other_object')
|
||||
end
|
||||
|
||||
tests("#copy_object('#{@directory.identity}', 'fog_object', 'fognonbucket', 'fog_other_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].copy_object(@directory.identity, 'fog_object', 'fognonbucket', 'fog_other_object')
|
||||
end
|
||||
|
||||
tests("#get_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].get_object('fognonbucket', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#get_object('#{@directory.identity}', 'fog_non_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].get_object(@directory.identity, 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#head_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].head_object('fognonbucket', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#head_object('#{@directory.identity}', 'fog_non_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].head_object(@directory.identity, 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#delete_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:aws].delete_object('fognonbucket', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#put_object_acl('#{@directory.identity}', 'fog_object', 'invalid')").raises(Excon::Errors::BadRequest) do
|
||||
Fog::Storage[:aws].put_object_acl('#{@directory.identity}', 'fog_object', 'invalid')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@directory.destroy
|
||||
|
||||
end
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
Shindo.tests('Fog::Storage[:google] | bucket requests', [:google]) do
|
||||
|
||||
tests('success') do
|
||||
|
||||
@bucket_format = {
|
||||
'CommonPrefixes' => [],
|
||||
'IsTruncated' => Fog::Boolean,
|
||||
'Marker' => NilClass,
|
||||
'Name' => String,
|
||||
'Prefix' => NilClass,
|
||||
'Contents' => [{
|
||||
'ETag' => String,
|
||||
'Key' => String,
|
||||
'LastModified' => Time,
|
||||
'Owner' => {
|
||||
'DisplayName' => String,
|
||||
'ID' => String
|
||||
},
|
||||
'Size' => Integer,
|
||||
'StorageClass' => String
|
||||
}]
|
||||
}
|
||||
|
||||
@service_format = {
|
||||
'Buckets' => [{
|
||||
'CreationDate' => Time,
|
||||
'Name' => String,
|
||||
}],
|
||||
'Owner' => {
|
||||
'ID' => String
|
||||
}
|
||||
}
|
||||
|
||||
tests("#put_bucket('fogbuckettests')").succeeds do
|
||||
Fog::Storage[:google].put_bucket('fogbuckettests')
|
||||
end
|
||||
|
||||
tests("#get_service").formats(@service_format) do
|
||||
Fog::Storage[:google].get_service.body
|
||||
end
|
||||
|
||||
file = Fog::Storage[:google].directories.get('fogbuckettests').files.create(:body => 'y', :key => 'x')
|
||||
|
||||
tests("#get_bucket('fogbuckettests)").formats(@bucket_format) do
|
||||
Fog::Storage[:google].get_bucket('fogbuckettests').body
|
||||
end
|
||||
|
||||
file.destroy
|
||||
|
||||
tests("#delete_bucket('fogbuckettests')").succeeds do
|
||||
Fog::Storage[:google].delete_bucket('fogbuckettests')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("#delete_bucket('fognonbucket')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].delete_bucket('fognonbucket')
|
||||
end
|
||||
|
||||
@bucket = Fog::Storage[:google].directories.create(:key => 'fognonempty')
|
||||
@file = @bucket.files.create(:key => 'foo', :body => 'bar')
|
||||
|
||||
tests("#delete_bucket('fognonempty')").raises(Excon::Errors::Conflict) do
|
||||
Fog::Storage[:google].delete_bucket('fognonempty')
|
||||
end
|
||||
|
||||
@file.destroy
|
||||
@bucket.destroy
|
||||
|
||||
tests("#get_bucket('fognonbucket')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].get_bucket('fognonbucket')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
Shindo.tests('Fog::Storage[:google] | object requests', [:google]) do
|
||||
|
||||
@directory = Fog::Storage[:google].directories.create(:key => 'fogobjecttests')
|
||||
|
||||
tests('success') do
|
||||
|
||||
tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file)").succeeds do
|
||||
Fog::Storage[:google].put_object(@directory.identity, 'fog_object', lorem_file)
|
||||
end
|
||||
|
||||
tests("#copy_object('#{@directory.identity}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").succeeds do
|
||||
Fog::Storage[:google].copy_object(@directory.identity, 'fog_object', @directory.identity, 'fog_other_object')
|
||||
end
|
||||
|
||||
@directory.files.get('fog_other_object').destroy
|
||||
|
||||
tests("#get_object('#{@directory.identity}', 'fog_object')").returns(lorem_file.read) do
|
||||
Fog::Storage[:google].get_object(@directory.identity, 'fog_object').body
|
||||
end
|
||||
|
||||
tests("#get_object('#{@directory.identity}', 'fog_object', &block)").returns(lorem_file.read) do
|
||||
data = ''
|
||||
Fog::Storage[:google].get_object(@directory.identity, 'fog_object') do |chunk, remaining_bytes, total_bytes|
|
||||
data << chunk
|
||||
end
|
||||
data
|
||||
end
|
||||
|
||||
tests("#head_object('#{@directory.identity}', 'fog_object')").succeeds do
|
||||
Fog::Storage[:google].head_object(@directory.identity, 'fog_object')
|
||||
end
|
||||
|
||||
tests("#delete_object('#{@directory.identity}', 'fog_object')").succeeds do
|
||||
Fog::Storage[:google].delete_object(@directory.identity, 'fog_object')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("#put_object('fognonbucket', 'fog_non_object', lorem_file)").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].put_object('fognonbucket', 'fog_non_object', lorem_file)
|
||||
end
|
||||
|
||||
tests("#copy_object('fognonbucket', 'fog_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].copy_object('fognonbucket', 'fog_object', @directory.identity, 'fog_other_object')
|
||||
end
|
||||
|
||||
tests("#copy_object('#{@directory.identity}', 'fog_non_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].copy_object(@directory.identity, 'fog_non_object', @directory.identity, 'fog_other_object')
|
||||
end
|
||||
|
||||
tests("#copy_object('#{@directory.identity}', 'fog_object', 'fognonbucket', 'fog_other_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].copy_object(@directory.identity, 'fog_object', 'fognonbucket', 'fog_other_object')
|
||||
end
|
||||
|
||||
tests("#get_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].get_object('fognonbucket', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#get_object('#{@directory.identity}', 'fog_non_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].get_object(@directory.identity, 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#head_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].head_object('fognonbucket', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#head_object('#{@directory.identity}', 'fog_non_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].head_object(@directory.identity, 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#delete_object('fognonbucket', 'fog_non_object')").raises(Excon::Errors::NotFound) do
|
||||
Fog::Storage[:google].delete_object('fognonbucket', 'fog_non_object')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@directory.destroy
|
||||
|
||||
end
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
Shindo.tests('Fog::Storage[:rackspace] | container requests', [:rackspace]) do
|
||||
|
||||
@container_format = [String]
|
||||
|
||||
@containers_format = [{
|
||||
'bytes' => Integer,
|
||||
'count' => Integer,
|
||||
'name' => String
|
||||
}]
|
||||
|
||||
tests('success') do
|
||||
|
||||
tests("#put_container('fogcontainertests')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].put_container('fogcontainertests')
|
||||
end
|
||||
|
||||
tests("#get_container('fogcontainertests')").formats(@container_format) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].get_container('fogcontainertests').body
|
||||
end
|
||||
|
||||
tests("#get_containers").formats(@containers_format) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].get_containers.body
|
||||
end
|
||||
|
||||
tests("#head_container('fogcontainertests')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].head_container('fogcontainertests')
|
||||
end
|
||||
|
||||
tests("#head_containers").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].head_containers
|
||||
end
|
||||
|
||||
tests("#delete_container('fogcontainertests')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].delete_container('fogcontainertests')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("#get_container('fognoncontainer')").raises(Fog::Storage::Rackspace::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].get_container('fognoncontainer')
|
||||
end
|
||||
|
||||
tests("#head_container('fognoncontainer')").raises(Fog::Storage::Rackspace::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].head_container('fognoncontainer')
|
||||
end
|
||||
|
||||
tests("#delete_container('fognoncontainer')").raises(Fog::Storage::Rackspace::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].delete_container('fognoncontainer')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
Shindo.tests('Fog::Storage[:rackspace] | large object requests', [:rackspace]) do
|
||||
|
||||
unless Fog.mocking?
|
||||
@directory = Fog::Storage[:rackspace].directories.create(:key => 'foglargeobjecttests')
|
||||
end
|
||||
|
||||
tests('success') do
|
||||
|
||||
tests("#put_object('foglargeobjecttests', 'fog_large_object/1', ('x' * 6 * 1024 * 1024))").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].put_object(@directory.identity, 'fog_large_object/1', ('x' * 6 * 1024 * 1024))
|
||||
end
|
||||
|
||||
tests("#put_object('foglargeobjecttests', 'fog_large_object/2', ('x' * 4 * 1024 * 1024))").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].put_object(@directory.identity, 'fog_large_object/2', ('x' * 4 * 1024 * 1024))
|
||||
end
|
||||
|
||||
tests("#put_object_manifest('foglargeobjecttests', 'fog_large_object')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].put_object_manifest(@directory.identity, 'fog_large_object')
|
||||
end
|
||||
|
||||
tests("#get_object('foglargeobjecttests', 'fog_large_object').body").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].get_object(@directory.identity, 'fog_large_object').body == ('x' * 10 * 1024 * 1024)
|
||||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
['fog_large_object', 'fog_large_object/1', 'fog_large_object/2'].each do |key|
|
||||
@directory.files.new(:key => key).destroy
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("put_object_manifest")
|
||||
|
||||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
@directory.destroy
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
Shindo.tests('Fog::Storage[:rackspace] | object requests', [:rackspace]) do
|
||||
|
||||
unless Fog.mocking?
|
||||
@directory = Fog::Storage[:rackspace].directories.create(:key => 'fogobjecttests')
|
||||
end
|
||||
|
||||
tests('success') do
|
||||
|
||||
tests("#put_object('fogobjecttests', 'fog_object')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].put_object('fogobjecttests', 'fog_object', lorem_file)
|
||||
end
|
||||
|
||||
tests("#get_object('fogobjectests', 'fog_object')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].get_object('fogobjecttests', 'fog_object')
|
||||
end
|
||||
|
||||
tests("#get_object('fogobjecttests', 'fog_object', &block)").returns(lorem_file.read) do
|
||||
pending if Fog.mocking?
|
||||
data = ''
|
||||
Fog::Storage[:rackspace].get_object('fogobjecttests', 'fog_object') do |chunk, remaining_bytes, total_bytes|
|
||||
data << chunk
|
||||
end
|
||||
data
|
||||
end
|
||||
|
||||
tests("#head_object('fogobjectests', 'fog_object')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].head_object('fogobjecttests', 'fog_object')
|
||||
end
|
||||
|
||||
tests("#delete_object('fogobjecttests', 'fog_object')").succeeds do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].delete_object('fogobjecttests', 'fog_object')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("#get_object('fogobjecttests', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].get_object('fogobjecttests', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#get_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].get_object('fognoncontainer', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#head_object('fogobjecttests', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].head_object('fogobjecttests', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#head_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].head_object('fognoncontainer', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#delete_object('fogobjecttests', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].delete_object('fogobjecttests', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#delete_object('fognoncontainer', 'fog_non_object')").raises(Fog::Storage::Rackspace::NotFound) do
|
||||
pending if Fog.mocking?
|
||||
Fog::Storage[:rackspace].delete_object('fognoncontainer', 'fog_non_object')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
unless Fog.mocking?
|
||||
@directory.destroy
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue