mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add more tests for containers and objects.
This commit is contained in:
parent
f6d26909f3
commit
1cc05f0417
2 changed files with 38 additions and 8 deletions
|
@ -34,6 +34,16 @@ Shindo.tests('Fog::Storage[:hp] | container requests', [:hp]) do
|
|||
Fog::Storage[:hp].delete_container('fogcontainertests')
|
||||
end
|
||||
|
||||
tests("#put_container('fogacltests', {'X-Container-Read' => 'private'})").succeeds do
|
||||
Fog::Storage[:hp].put_container('fogacltests', {'X-Container-Read' => 'private'})
|
||||
end
|
||||
Fog::Storage[:hp].delete_container('fogacltests')
|
||||
|
||||
tests("#put_container('fogacltests', {'X-Container-Read' => 'public-read'})").succeeds do
|
||||
Fog::Storage[:hp].put_container('fogacltests', {'X-Container-Read' => 'public-read'})
|
||||
end
|
||||
Fog::Storage[:hp].delete_container('fogacltests')
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
@ -50,6 +60,18 @@ Shindo.tests('Fog::Storage[:hp] | container requests', [:hp]) do
|
|||
Fog::Storage[:hp].delete_container('fognoncontainer')
|
||||
end
|
||||
|
||||
@container = Fog::Storage[:hp].directories.create(:key => 'fognonempty')
|
||||
@file = @container.files.create(:key => 'foo', :body => 'bar')
|
||||
tests("#delete_container('fognonempty')").raises(Excon::Errors::Conflict) do
|
||||
Fog::Storage[:hp].delete_container('fognonempty')
|
||||
end
|
||||
@file.destroy
|
||||
@container.destroy
|
||||
|
||||
tests("#put_container('fognonbucket', {'X-Container-Read' => 'invalid'})").raises(Excon::Errors::BadRequest) do
|
||||
Fog::Storage[:hp].put_container('fognonbucket', {'X-Container-Read' => 'invalid'})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -5,15 +5,15 @@ Shindo.tests('Fog::Storage[:hp] | object requests', [:hp]) do
|
|||
|
||||
tests('success') do
|
||||
|
||||
tests("#put_object(#{@dir_name}, 'fog_object')").succeeds do
|
||||
tests("#put_object('#{@dir_name}', 'fog_object')").succeeds do
|
||||
Fog::Storage[:hp].put_object(@dir_name, 'fog_object', lorem_file)
|
||||
end
|
||||
|
||||
tests("#get_object(#{@dir_name}, 'fog_object')").succeeds do
|
||||
tests("#get_object('#{@dir_name}', 'fog_object')").succeeds do
|
||||
Fog::Storage[:hp].get_object(@dir_name, 'fog_object')
|
||||
end
|
||||
|
||||
tests("#get_object(#{@dir_name}, 'fog_object', &block)").returns(lorem_file.read) do
|
||||
tests("#get_object('#{@dir_name}', 'fog_object', &block)").returns(lorem_file.read) do
|
||||
data = ''
|
||||
Fog::Storage[:hp].get_object(@dir_name, 'fog_object') do |chunk, remaining_bytes, total_bytes|
|
||||
data << chunk
|
||||
|
@ -21,19 +21,27 @@ Shindo.tests('Fog::Storage[:hp] | object requests', [:hp]) do
|
|||
data
|
||||
end
|
||||
|
||||
tests("#head_object(#{@dir_name}, 'fog_object')").succeeds do
|
||||
tests("#head_object('#{@dir_name}', 'fog_object')").succeeds do
|
||||
Fog::Storage[:hp].head_object(@dir_name, 'fog_object')
|
||||
end
|
||||
|
||||
tests("#delete_object(#{@dir_name}, 'fog_object')").succeeds do
|
||||
tests("#delete_object('#{@dir_name}', 'fog_object')").succeeds do
|
||||
Fog::Storage[:hp].delete_object(@dir_name, 'fog_object')
|
||||
end
|
||||
|
||||
#tests("#put_object('#{@dir_name}', 'fog_other_object', nil, {'X-Copy-From' => '/#{@dir_name}/fog_object'})" ).succeeds do
|
||||
# Fog::Storage[:hp].put_object(@dir_name, 'fog_other_object', nil, {'X-Copy-From' => "/#{@dir_name}/fog_object"})
|
||||
#end
|
||||
#@directory.files.get('fog_other_object').destroy
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("#get_object(#{@dir_name}, 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do
|
||||
tests("#put_object('fognoncontainer', 'fog_object')").raises(Fog::Storage::HP::NotFound) do
|
||||
Fog::Storage[:hp].put_object('fognoncontainer', 'fog_object', lorem_file)
|
||||
end
|
||||
|
||||
tests("#get_object('#{@dir_name}', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do
|
||||
Fog::Storage[:hp].get_object(@dir_name, 'fog_non_object')
|
||||
end
|
||||
|
||||
|
@ -41,7 +49,7 @@ Shindo.tests('Fog::Storage[:hp] | object requests', [:hp]) do
|
|||
Fog::Storage[:hp].get_object('fognoncontainer', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#head_object(#{@dir_name}, 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do
|
||||
tests("#head_object('#{@dir_name}', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do
|
||||
Fog::Storage[:hp].head_object(@dir_name, 'fog_non_object')
|
||||
end
|
||||
|
||||
|
@ -49,7 +57,7 @@ Shindo.tests('Fog::Storage[:hp] | object requests', [:hp]) do
|
|||
Fog::Storage[:hp].head_object('fognoncontainer', 'fog_non_object')
|
||||
end
|
||||
|
||||
tests("#delete_object(#{@dir_name}, 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do
|
||||
tests("#delete_object('#{@dir_name}', 'fog_non_object')").raises(Fog::Storage::HP::NotFound) do
|
||||
Fog::Storage[:hp].delete_object(@dir_name, 'fog_non_object')
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue