mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[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
This commit is contained in:
parent
f0d9c8aebd
commit
87d81967fa
4 changed files with 30 additions and 18 deletions
|
@ -16,7 +16,6 @@ module Fog
|
|||
request :create_record
|
||||
request :list_records
|
||||
request :delete_record
|
||||
request :get_record
|
||||
|
||||
class Mock
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
29
tests/dreamhost/models/dns/records_tests.rb
Normal file
29
tests/dreamhost/models/dns/records_tests.rb
Normal file
|
@ -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
|
||||
|
Loading…
Reference in a new issue