mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[storage|ninefold] fix file#destroy and test cleanup
This commit is contained in:
parent
b6921d255b
commit
97d98113e7
3 changed files with 40 additions and 43 deletions
|
@ -30,7 +30,7 @@ module Fog
|
|||
|
||||
def destroy
|
||||
requires :directory, :key
|
||||
connection.delete_namespace(directory.key + key)
|
||||
connection.delete_namespace([directory.key, key].join('/'))
|
||||
true
|
||||
end
|
||||
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
if storage_providers.keys.include? :ninefold
|
||||
for provider, config in storage_providers
|
||||
|
||||
Shindo.tests("Storage[:ninefold] | nested directories", [provider]) do
|
||||
ninefold = Fog::Storage[:ninefold]
|
||||
tests("update a file").succeeds do
|
||||
pending if Fog.mocking?
|
||||
dir = ninefold.directories.create(:key => 'updatefiletests')
|
||||
f = dir.files.create(:key => 'lorem.txt', :body => lorem_file)
|
||||
f.body = "xxxxxx"
|
||||
f.save
|
||||
end
|
||||
end
|
||||
Shindo.tests("Storage[:ninefold] | nested directories", ['ninefold']) do
|
||||
|
||||
unless Fog.mocking?
|
||||
@directory = Fog::Storage[:ninefold].directories.create(:key => 'updatefiletests')
|
||||
end
|
||||
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,29 +1,23 @@
|
|||
if storage_providers.keys.include? :ninefold
|
||||
for provider, config in storage_providers
|
||||
|
||||
Shindo.tests("Storage[:ninefold] | nested directories", [provider]) 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
|
||||
|
||||
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
|
||||
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
|
Loading…
Add table
Reference in a new issue