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

[dns] consolidate tests

This commit is contained in:
geemus 2010-12-29 17:23:40 -08:00
parent 803ceefb91
commit d3872679b8
29 changed files with 66 additions and 121 deletions

View file

@ -1,5 +0,0 @@
Shindo.tests('AWS::DNS | zone model', ['aws']) do
zone_tests(AWS[:dns], {}, false)
end

View file

@ -1,5 +0,0 @@
Shindo.tests('AWS::DNS | zones collection', ['aws']) do
zones_tests(AWS[:dns], {}, false)
end

14
tests/dns/helper.rb Normal file
View file

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

View file

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

View file

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

View file

@ -0,0 +1,9 @@
for provider, config in dns_providers
params = {
:domain => 'fogzonetests.com'
}.merge!(config[:zone_params] || {})
model_tests(provider[:dns].zones, params, config[:mocked])
end

View file

@ -0,0 +1,9 @@
for provider, config in dns_providers
params = {
:domain => 'fogzonestests.com'
}.merge!(config[:zones_params] || {})
collection_tests(provider[:dns].zones, params, config[:mocked])
end

View file

@ -14,11 +14,6 @@ require 'helpers/compute/flavors_tests'
require 'helpers/compute/server_tests'
require 'helpers/compute/servers_tests'
require 'helpers/dns/record_tests'
require 'helpers/dns/records_tests'
require 'helpers/dns/zone_tests'
require 'helpers/dns/zones_tests'
require 'helpers/storage/directory_tests'
require 'helpers/storage/directories_tests'
require 'helpers/storage/file_tests'

View file

@ -1,13 +0,0 @@
def record_tests(connection, params = {}, mocks_implemented = true)
params = {:ip => '1.2.3.4', :name => 'www.fogrecordtests.com', :type => 'A'}.merge!(params)
if !Fog.mocking? || mocks_implemented
@zone = connection.zones.create(:domain => 'fogrecordtests.com')
model_tests(@zone.records, params, mocks_implemented)
@zone.destroy
end
end

View file

@ -1,13 +0,0 @@
def records_tests(connection, params = {}, mocks_implemented = true)
params = {:ip => '1.2.3.4', :name => 'www.fogrecordstests.com', :type => 'A'}.merge!(params)
if !Fog.mocking? || mocks_implemented
@zone = connection.zones.create(:domain => 'fogrecordstests.com')
collection_tests(@zone.records, params, mocks_implemented)
@zone.destroy
end
end

View file

@ -1,7 +0,0 @@
def zone_tests(connection, params = {}, mocks_implemented = true)
params = {:domain => 'fogzonetests.com'}.merge!(params)
model_tests(connection.zones, params, mocks_implemented)
end

View file

@ -1,7 +0,0 @@
def zones_tests(connection, params = {}, mocks_implemented = true)
params = {:domain => 'fogzonestests.com'}.merge!(params)
collection_tests(connection.zones, params, mocks_implemented)
end

View file

@ -1,5 +0,0 @@
Shindo.tests('Linode::DNS | record model', ['linode']) do
record_tests(Linode[:dns], {}, false)
end

View file

@ -1,5 +0,0 @@
Shindo.tests('Linode::DNS | records collection', ['linode']) do
records_tests(Linode[:dns], {}, false)
end

View file

@ -1,11 +0,0 @@
Shindo.tests('Linode::DNS | zone model', ['linode']) do
zone_tests(Linode[:dns], {}, false) do
if !Fog.mocking? || mocks_implemented
@instance.responds_to(:nameservers)
end
end
end

View file

@ -1,5 +0,0 @@
Shindo.tests('Linode::DNS | zones collection', ['linode']) do
zones_tests(Linode[:dns], {}, false)
end

View file

@ -1,5 +0,0 @@
Shindo.tests('Slicehost::DNS | record model', ['slicehost']) do
record_tests(Slicehost[:dns], {}, false)
end

View file

@ -1,5 +0,0 @@
Shindo.tests('Slicehost::DNS | records collection', ['slicehost']) do
records_tests(Slicehost[:dns], {}, false)
end

View file

@ -1,5 +0,0 @@
Shindo.tests('Slicehost::DNS | zone model', ['slicehost']) do
zone_tests(Slicehost[:dns], {}, false)
end

View file

@ -1,5 +0,0 @@
Shindo.tests('Slicehost::DNS | zones collection', ['slicehost']) do
zones_tests(Slicehost[:dns], {}, false)
end

View file

View file

@ -1,5 +0,0 @@
Shindo.tests('Zerigo::DNS | record model', ['zerigo']) do
record_tests(Zerigo[:dns], {}, false)
end

View file

@ -1,5 +0,0 @@
Shindo.tests('Zerigo::DNS | records collection', ['zerigo']) do
records_tests(Zerigo[:dns], {}, false)
end

View file

@ -1,5 +0,0 @@
Shindo.tests('Zerigo::DNS | zone model', ['zerigo']) do
zone_tests(Zerigo[:dns], {}, false)
end

View file

@ -1,5 +0,0 @@
Shindo.tests('Zerigo::DNS | zones collection', ['zerigo']) do
zones_tests(Zerigo[:dns], {}, false)
end