2011-02-07 22:12:56 -05:00
|
|
|
Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
|
2011-02-08 22:03:06 -05:00
|
|
|
tests "success" do
|
2011-06-19 04:09:58 -04:00
|
|
|
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
|
2011-02-07 22:12:56 -05:00
|
|
|
response = Dynect[:dns].session
|
2011-02-08 21:47:05 -05:00
|
|
|
returns(true) { response.body['Auth-Token'] =~ /.+=$/ && true }
|
2011-02-08 10:08:50 -05:00
|
|
|
returns(true) { response.body['API-Version'] == "2.3.1" }
|
|
|
|
returns(true) { response.status == 200 }
|
2011-02-07 22:12:56 -05:00
|
|
|
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
|
|
|
|
2011-06-17 06:17:02 -04:00
|
|
|
tests "get zone" do
|
2011-06-19 04:09:58 -04:00
|
|
|
response = Dynect[:dns].get_zone(zone)
|
|
|
|
returns(true) { response.body['zone'] == zone }
|
2011-06-17 06:17:02 -04:00
|
|
|
returns(true) { response.body['serial'] > 0 }
|
|
|
|
returns(true) { response.body['zone_type'] == "Primary" }
|
|
|
|
returns(true) { response.body['serial_style'] == "increment" }
|
|
|
|
end
|
|
|
|
|
2011-06-19 04:09:58 -04:00
|
|
|
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)
|
2011-06-19 04:09:58 -04:00
|
|
|
returns("127.0.0.2") { records.last.value }
|
|
|
|
end
|
2011-06-17 06:17:02 -04:00
|
|
|
|
2011-06-16 17:51:13 -04:00
|
|
|
tests "create record"
|
|
|
|
tests "delete record"
|
|
|
|
tests "update record"
|
|
|
|
tests "list jobs"
|
2011-02-07 22:12:56 -05:00
|
|
|
end
|
|
|
|
end
|