From 87d81967fabafb01dbff6accd74b5e2f2ceb7978 Mon Sep 17 00:00:00 2001 From: Sergio Rubio Date: Mon, 21 Jan 2013 21:36:11 +0100 Subject: [PATCH] [dreamhost|dns] Removed get_record request - The request does not map to a Dreamhost API request, remove it. - Updated the Records collection to use list_records instead of get_record in Records#get - Added Records collection model test --- lib/fog/dreamhost/dns.rb | 1 - lib/fog/dreamhost/models/dns/records.rb | 2 +- lib/fog/dreamhost/requests/dns/get_record.rb | 16 ----------- tests/dreamhost/models/dns/records_tests.rb | 29 ++++++++++++++++++++ 4 files changed, 30 insertions(+), 18 deletions(-) delete mode 100644 lib/fog/dreamhost/requests/dns/get_record.rb create mode 100644 tests/dreamhost/models/dns/records_tests.rb diff --git a/lib/fog/dreamhost/dns.rb b/lib/fog/dreamhost/dns.rb index 46ae84496..3aad66f61 100644 --- a/lib/fog/dreamhost/dns.rb +++ b/lib/fog/dreamhost/dns.rb @@ -16,7 +16,6 @@ module Fog request :create_record request :list_records request :delete_record - request :get_record class Mock diff --git a/lib/fog/dreamhost/models/dns/records.rb b/lib/fog/dreamhost/models/dns/records.rb index a5aa9de25..fc10a8e79 100644 --- a/lib/fog/dreamhost/models/dns/records.rb +++ b/lib/fog/dreamhost/models/dns/records.rb @@ -20,7 +20,7 @@ module Fog end def get(record_name) - data = service.get_record(record_name).body['data'].find { |r| r['record'] == record_name } + data = service.list_records.body['data'].find { |r| r['record'] == record_name } new(data) rescue Excon::Errors::NotFound nil diff --git a/lib/fog/dreamhost/requests/dns/get_record.rb b/lib/fog/dreamhost/requests/dns/get_record.rb deleted file mode 100644 index 676fb913e..000000000 --- a/lib/fog/dreamhost/requests/dns/get_record.rb +++ /dev/null @@ -1,16 +0,0 @@ -module Fog - module DNS - class Dreamhost - class Real - - def get_record(record_name) - data = request( :expects => 200, - :method => "GET", - :path => "/", - :query => { :cmd => 'dns-list_records' } ) - end - - end - end - end -end diff --git a/tests/dreamhost/models/dns/records_tests.rb b/tests/dreamhost/models/dns/records_tests.rb new file mode 100644 index 000000000..3573e8789 --- /dev/null +++ b/tests/dreamhost/models/dns/records_tests.rb @@ -0,0 +1,29 @@ +Shindo.tests("Fog::DNS[:dreamhost] | records", ['dreamhost', 'dns']) do + + service = Fog::DNS[:dreamhost] + + tests('#all') do + records = service.records + + test('should be an array') { records.is_a? Array } + + test('should not be empty') { !records.empty? } + + tests('should list Fog::DNS::Dreamhost::Record') do + records.each do |r| + test("as records") { r.is_a?(Fog::DNS::Dreamhost::Record) } + end + end + end + + tests('#get') do + tests('should fetch a record') do + record = service.records.get do_not_delete_record + test('should be a Fog::DNS::Dreamhost::Record') do + record.is_a? Fog::DNS::Dreamhost::Record + end + end + end + +end +