1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/dns/requests/dynect/dns_tests.rb

54 lines
1.5 KiB
Ruby
Raw Normal View History

Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
2011-02-08 22:03:06 -05:00
tests "success" do
def zone
ENV['DYNECT_ZONE']
end
def fqdn
ENV['DYNECT_FQDN']
end
2011-02-08 22:03:06 -05:00
tests "start api session" do
response = Dynect[:dns].session
2011-02-08 21:47:05 -05:00
returns(true) { response.body['Auth-Token'] =~ /.+=$/ && true }
returns(true) { response.body['API-Version'] == "2.3.1" }
returns(true) { response.status == 200 }
end
2011-02-08 21:47:44 -05:00
2011-02-08 22:03:06 -05:00
tests "list zones" do
2011-06-17 06:51:37 -04:00
response = Dynect[:dns].list_zones
2011-02-08 22:03:06 -05:00
returns(true) { response.body['zones'].first =~ /\.com/ && true }
2011-02-08 21:47:44 -05:00
returns(true) { response.status == 200 }
end
2011-06-16 17:51:13 -04:00
tests "get zone" do
response = Dynect[:dns].get_zone(zone)
returns(true) { response.body['zone'] == zone }
returns(true) { response.body['serial'] > 0 }
returns(true) { response.body['zone_type'] == "Primary" }
returns(true) { response.body['serial_style'] == "increment" }
end
tests "list records" do
responses = Dynect[:dns].list_any_records(zone, fqdn)
returns(3) { responses.size }
returns(30) { responses.map(&:body).first['ttl'] }
end
tests "list zone nodes" do
response = Dynect[:dns].node_list(zone)
returns(zone) { response.body.first }
end
tests "model" do
2011-06-19 04:22:42 -04:00
records = Fog::DNS.new(:provider => "Dynect").zones.get(zone).records.all(fqdn)
returns("127.0.0.2") { records.last.value }
end
2011-06-16 17:51:13 -04:00
tests "create record"
tests "delete record"
tests "update record"
tests "list jobs"
end
end