mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[storage] consolidate tests
This commit is contained in:
parent
d3872679b8
commit
4bfa288da6
31 changed files with 56 additions and 112 deletions
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('AWS::Storage | directories collection', ['aws']) do
|
||||
|
||||
directories_tests(AWS[:storage])
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('AWS::Storage | directory model', ['aws']) do
|
||||
|
||||
directory_tests(AWS[:storage])
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('AWS::Storage | file model', ['aws']) do
|
||||
|
||||
file_tests(AWS[:storage])
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('AWS::Storage | files collection', ['aws']) do
|
||||
|
||||
files_tests(AWS[:storage])
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Google::Storage | directories collection', ['google']) do
|
||||
|
||||
directories_tests(Google[:storage])
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Google::Storage | directory model', ['google']) do
|
||||
|
||||
directory_tests(Google[:storage])
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Google::Storage | file model', ['google']) do
|
||||
|
||||
file_tests(Google[:storage])
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Google::Storage | files collection', ['google']) do
|
||||
|
||||
files_tests(Google[:storage])
|
||||
|
||||
end
|
|
@ -14,11 +14,6 @@ require 'helpers/compute/flavors_tests'
|
|||
require 'helpers/compute/server_tests'
|
||||
require 'helpers/compute/servers_tests'
|
||||
|
||||
require 'helpers/storage/directory_tests'
|
||||
require 'helpers/storage/directories_tests'
|
||||
require 'helpers/storage/file_tests'
|
||||
require 'helpers/storage/files_tests'
|
||||
|
||||
# Use so you can run in mock mode from the command line:
|
||||
#
|
||||
# FOG_MOCK=true fog
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
def directories_tests(connection, params = {}, mocks_implemented = true)
|
||||
|
||||
params = {:key => 'fogdirectoriestests'}.merge!(params)
|
||||
|
||||
collection_tests(connection.directories, params, mocks_implemented)
|
||||
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
def files_tests(connection, params = {}, mocks_implemented = true)
|
||||
|
||||
params = {:key => 'fog_files_tests', :body => lorem_file}.merge!(params)
|
||||
|
||||
if !Fog.mocking? || mocks_implemented
|
||||
@directory = connection.directories.create(:key => 'fogfilestests')
|
||||
|
||||
collection_tests(@directory.files, params, mocks_implemented)
|
||||
|
||||
@directory.destroy
|
||||
end
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Local::Storage | directories collection', ['local']) do
|
||||
|
||||
directories_tests(Local[:storage], {}, false)
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Local::Storage | directory model', ['local']) do
|
||||
|
||||
directory_tests(Local[:storage], {}, false)
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Local::Storage | file model', ['local']) do
|
||||
|
||||
file_tests(Local[:storage], {}, false)
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Local::Storage | files collection', ['local']) do
|
||||
|
||||
files_tests(Local[:storage], {}, false)
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Rackspace::Storage | directories collection', ['rackspace']) do
|
||||
|
||||
directories_tests(Rackspace[:storage], {}, false)
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Rackspace::Storage | directory model', ['rackspace']) do
|
||||
|
||||
directory_tests(Rackspace[:storage], {}, false)
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Rackspace::Storage | file model', ['rackspace']) do
|
||||
|
||||
file_tests(Rackspace[:storage], {}, false)
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
Shindo.tests('Rackspace::Storage | files collection', ['rackspace']) do
|
||||
|
||||
files_tests(Rackspace[:storage], {}, false)
|
||||
|
||||
end
|
14
tests/storage/helper.rb
Normal file
14
tests/storage/helper.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
dns_providers = {
|
||||
AWS => {
|
||||
:mocked => true
|
||||
},
|
||||
Google => {
|
||||
:mocked => true
|
||||
},
|
||||
Local => {
|
||||
:mocked => true
|
||||
},
|
||||
Rackspace => {
|
||||
:mocked => false
|
||||
}
|
||||
}
|
9
tests/storage/models/directories_tests.rb
Normal file
9
tests/storage/models/directories_tests.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
for provider, config in dns_providers
|
||||
|
||||
params = {
|
||||
:key => 'fogdirectoriestests',
|
||||
}.merge!(config[:directories_params] || {})
|
||||
|
||||
collection_tests(provider[:storage].directories, params, config[:mocked])
|
||||
|
||||
end
|
|
@ -1,8 +1,10 @@
|
|||
def directory_tests(connection, params = {}, mocks_implemented = true)
|
||||
for provider, config in dns_providers
|
||||
|
||||
params = {:key => 'fogdirectorytests'}.merge!(params)
|
||||
params = {
|
||||
:key => 'fogdirectorytests'
|
||||
}.merge!(config[:directory_params] || {})
|
||||
|
||||
model_tests(connection.directories, params, mocks_implemented) do
|
||||
model_tests(provider[:storage].directory, params, config[:mocked]) do
|
||||
|
||||
tests("#public=(true)").succeeds do
|
||||
pending if Fog.mocking? && !mocks_implemented
|
|
@ -1,11 +1,16 @@
|
|||
def file_tests(connection, params = {}, mocks_implemented = true)
|
||||
for provider, config in dns_providers
|
||||
|
||||
params = {:key => 'fog_file_tests', :body => lorem_file, :public => true}.merge!(params)
|
||||
params = {
|
||||
:key => 'fog_file_tests',
|
||||
:body => lorem_file,
|
||||
:public => true
|
||||
}.merge!(config[:directory_params] || {})
|
||||
|
||||
if !Fog.mocking? || mocks_implemented
|
||||
@directory = connection.directories.create(:key => 'fogfilestests')
|
||||
|
||||
model_tests(@directory.files, params, mocks_implemented) do
|
||||
@directory = provider[:storage].directories.create(:key => 'fogfilestests')
|
||||
|
||||
model_tests(@directory.files, params, config[:mocked]) do
|
||||
|
||||
responds_to(:public_url)
|
||||
|
||||
|
@ -22,6 +27,7 @@ def file_tests(connection, params = {}, mocks_implemented = true)
|
|||
end
|
||||
|
||||
@directory.destroy
|
||||
|
||||
end
|
||||
|
||||
end
|
18
tests/storage/models/files_tests.rb
Normal file
18
tests/storage/models/files_tests.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
for provider, config in dns_providers
|
||||
|
||||
params = {
|
||||
:key => 'fog_files_tests',
|
||||
:body => lorem_file
|
||||
}.merge!(config[:files_params] || {})
|
||||
|
||||
if !Fog.mocking? || mocks_implemented
|
||||
|
||||
@directory = provider.directories.create(:key => 'fogfilestests')
|
||||
|
||||
collection_tests(@directory.files, params, config[:mocked])
|
||||
|
||||
@directory.destroy
|
||||
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue