1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[dns&storage] fix errors in shared tests

This commit is contained in:
geemus 2011-01-03 11:23:51 -08:00
parent fa0447df1e
commit 5f3c6e55d5
10 changed files with 134 additions and 98 deletions

View file

@ -1,14 +1,16 @@
dns_providers = {
AWS => {
:mocked => false
},
Linode => {
:mocked => false
},
Slicehost => {
:mocked => false
},
Zerigo => {
:mocked => false
def dns_providers
{
AWS => {
:mocked => false
},
Linode => {
:mocked => false
},
Slicehost => {
:mocked => false
},
Zerigo => {
:mocked => false
}
}
}
end

View file

@ -1,17 +1,21 @@
for provider, config in dns_providers
params = {
:ip => '1.2.3.4',
:name => 'www.fogrecordtests.com',
:type => 'A'
}.merge!(config[:record_params] || {})
Shindo.tests("#{provider}::DNS | record", [provider.to_s.downcase]) do
if !Fog.mocking? || provider[:mocked]
@zone = provider[:dns].zones.create(:domain => 'fogrecordtests.com')
params = {
:ip => '1.2.3.4',
:name => 'www.fogrecordtests.com',
:type => 'A'
}.merge!(config[:record_params] || {})
model_tests(@zone.records, params, config[:mocked])
if !Fog.mocking? || provider[:mocked]
@zone = provider[:dns].zones.create(:domain => 'fogrecordtests.com')
model_tests(@zone.records, params, config[:mocked])
@zone.destroy
end
@zone.destroy
end
end

View file

@ -1,17 +1,21 @@
for provider, config in dns_providers
params = {
:ip => '1.2.3.4',
:name => 'www.fogrecordstests.com',
:type => 'A'
}.merge!(config[:records_params] || {})
Shindo.tests("#{provider}::DNS | records", [provider.to_s.downcase]) do
if !Fog.mocking? || provider[:mocked]
@zone = provider[:dns].zones.create(:domain => 'fogrecordstests.com')
params = {
:ip => '1.2.3.4',
:name => 'www.fogrecordstests.com',
:type => 'A'
}.merge!(config[:records_params] || {})
collection_tests(@zone.records, params, config[:mocked])
if !Fog.mocking? || provider[:mocked]
@zone = provider[:dns].zones.create(:domain => 'fogrecordstests.com')
collection_tests(@zone.records, params, config[:mocked])
@zone.destroy
end
@zone.destroy
end
end

View file

@ -1,9 +1,13 @@
for provider, config in dns_providers
params = {
:domain => 'fogzonetests.com'
}.merge!(config[:zone_params] || {})
Shindo.tests("#{provider}::DNS | zone", [provider.to_s.downcase]) do
model_tests(provider[:dns].zones, params, config[:mocked])
params = {
:domain => 'fogzonetests.com'
}.merge!(config[:zone_params] || {})
model_tests(provider[:dns].zones, params, config[:mocked])
end
end

View file

@ -1,9 +1,13 @@
for provider, config in dns_providers
params = {
:domain => 'fogzonestests.com'
}.merge!(config[:zones_params] || {})
Shindo.tests("#{provider}::DNS | zones", [provider.to_s.downcase]) do
collection_tests(provider[:dns].zones, params, config[:mocked])
params = {
:domain => 'fogzonestests.com'
}.merge!(config[:zones_params] || {})
end
collection_tests(provider[:dns].zones, params, config[:mocked])
end
end

View file

@ -1,14 +1,16 @@
dns_providers = {
AWS => {
:mocked => true
},
Google => {
:mocked => true
},
Local => {
:mocked => true
},
Rackspace => {
:mocked => false
def storage_providers
{
AWS => {
:mocked => true
},
Google => {
:mocked => true
},
Local => {
:mocked => true
},
Rackspace => {
:mocked => false
}
}
}
end

View file

@ -1,9 +1,13 @@
for provider, config in dns_providers
for provider, config in storage_providers
params = {
:key => 'fogdirectoriestests',
}.merge!(config[:directories_params] || {})
Shindo.tests("#{provider}::Storage | directories", [provider.to_s.downcase]) do
collection_tests(provider[:storage].directories, params, config[:mocked])
params = {
:key => 'fogdirectoriestests',
}.merge!(config[:directories_params] || {})
end
collection_tests(provider[:storage].directories, params, config[:mocked])
end
end

View file

@ -1,18 +1,22 @@
for provider, config in dns_providers
for provider, config in storage_providers
params = {
:key => 'fogdirectorytests'
}.merge!(config[:directory_params] || {})
Shindo.tests("#{provider}::Storage | directory", [provider.to_s.downcase]) do
model_tests(provider[:storage].directory, params, config[:mocked]) do
params = {
:key => 'fogdirectorytests'
}.merge!(config[:directory_params] || {})
tests("#public=(true)").succeeds do
pending if Fog.mocking? && !mocks_implemented
@instance.public=(true)
end
model_tests(provider[:storage].directory, params, config[:mocked]) do
tests("#public=(true)").succeeds do
pending if Fog.mocking? && !config[:mocked]
@instance.public=(true)
end
if !Fog.mocking? || config[:mocked]
@instance.responds_to(:public_url)
end
if !Fog.mocking? || mocks_implemented
@instance.responds_to(:public_url)
end
end

View file

@ -1,33 +1,37 @@
for provider, config in dns_providers
for provider, config in storage_providers
params = {
:key => 'fog_file_tests',
:body => lorem_file,
:public => true
}.merge!(config[:directory_params] || {})
Shindo.tests("#{provider}::Storage | file", [provider.to_s.downcase]) do
if !Fog.mocking? || mocks_implemented
params = {
:key => 'fog_file_tests',
:body => lorem_file,
:public => true
}.merge!(config[:directory_params] || {})
@directory = provider[:storage].directories.create(:key => 'fogfilestests')
if !Fog.mocking? || config[:mocked]
model_tests(@directory.files, params, config[:mocked]) do
@directory = provider[:storage].directories.create(:key => 'fogfilestests')
responds_to(:public_url)
model_tests(@directory.files, params, config[:mocked]) do
responds_to(:public_url)
tests("#public=(true)").succeeds do
pending if Fog.mocking? && !config[:mocked]
@instance.public=(true)
end
test("@instance.public_url.nil? || Excon.get(@instance.public_url).body == lorem_file.read") do
pending if Fog.mocking?
@instance.public_url.nil? || Excon.get(@instance.public_url).body == lorem_file.read
end
tests("#public=(true)").succeeds do
pending if Fog.mocking? && !mocks_implemented
@instance.public=(true)
end
test("@instance.public_url.nil? || Excon.get(@instance.public_url).body == lorem_file.read") do
pending if Fog.mocking?
@instance.public_url.nil? || Excon.get(@instance.public_url).body == lorem_file.read
end
@directory.destroy
end
@directory.destroy
end
end

View file

@ -1,17 +1,21 @@
for provider, config in dns_providers
for provider, config in storage_providers
params = {
:key => 'fog_files_tests',
:body => lorem_file
}.merge!(config[:files_params] || {})
Shindo.tests("#{provider}::Storage | files", [provider.to_s.downcase]) do
if !Fog.mocking? || mocks_implemented
params = {
:key => 'fog_files_tests',
:body => lorem_file
}.merge!(config[:files_params] || {})
@directory = provider.directories.create(:key => 'fogfilestests')
if !Fog.mocking? || config[:mocked]
collection_tests(@directory.files, params, config[:mocked])
@directory = provider.directories.create(:key => 'fogfilestests')
@directory.destroy
collection_tests(@directory.files, params, config[:mocked])
@directory.destroy
end
end