From 5bef13f5d792cd2e8d37bb95b92a4c44f7dcb7ea Mon Sep 17 00:00:00 2001 From: Joshua Lane Date: Tue, 14 Feb 2017 09:49:09 -0800 Subject: [PATCH 1/2] extract DNSimple, require 'fog-dnsimple' BREAKING CHANGE fog-dnsimple uses the Dnsimple constant (conventional) where fog previously used DNSimple. I could alias the constant but that doesn't change the `Fog.providers[:dnsimple]` value. --- fog.gemspec | 1 + lib/fog/bin/dnsimple.rb | 29 ----- lib/fog/dnsimple.rb | 1 - lib/fog/dnsimple/core.rb | 10 -- lib/fog/dnsimple/dns.rb | 112 ------------------ lib/fog/dnsimple/models/dns/record.rb | 63 ---------- lib/fog/dnsimple/models/dns/records.rb | 34 ------ lib/fog/dnsimple/models/dns/zone.rb | 46 ------- lib/fog/dnsimple/models/dns/zones.rb | 25 ---- .../dnsimple/requests/dns/create_domain.rb | 62 ---------- .../dnsimple/requests/dns/create_record.rb | 67 ----------- .../dnsimple/requests/dns/delete_domain.rb | 35 ------ .../dnsimple/requests/dns/delete_record.rb | 30 ----- lib/fog/dnsimple/requests/dns/get_domain.rb | 39 ------ lib/fog/dnsimple/requests/dns/get_record.rb | 49 -------- lib/fog/dnsimple/requests/dns/list_domains.rb | 34 ------ lib/fog/dnsimple/requests/dns/list_records.rb | 34 ------ .../dnsimple/requests/dns/update_record.rb | 53 --------- spec/fog/bin/dnsimple_spec.rb | 4 +- spec/fog/bin_spec.rb | 6 +- 20 files changed, 6 insertions(+), 728 deletions(-) delete mode 100644 lib/fog/bin/dnsimple.rb delete mode 100644 lib/fog/dnsimple.rb delete mode 100644 lib/fog/dnsimple/core.rb delete mode 100644 lib/fog/dnsimple/dns.rb delete mode 100644 lib/fog/dnsimple/models/dns/record.rb delete mode 100644 lib/fog/dnsimple/models/dns/records.rb delete mode 100644 lib/fog/dnsimple/models/dns/zone.rb delete mode 100644 lib/fog/dnsimple/models/dns/zones.rb delete mode 100644 lib/fog/dnsimple/requests/dns/create_domain.rb delete mode 100644 lib/fog/dnsimple/requests/dns/create_record.rb delete mode 100644 lib/fog/dnsimple/requests/dns/delete_domain.rb delete mode 100644 lib/fog/dnsimple/requests/dns/delete_record.rb delete mode 100644 lib/fog/dnsimple/requests/dns/get_domain.rb delete mode 100644 lib/fog/dnsimple/requests/dns/get_record.rb delete mode 100644 lib/fog/dnsimple/requests/dns/list_domains.rb delete mode 100644 lib/fog/dnsimple/requests/dns/list_records.rb delete mode 100644 lib/fog/dnsimple/requests/dns/update_record.rb diff --git a/fog.gemspec b/fog.gemspec index 81cef1a119..77fdc2f001 100644 --- a/fog.gemspec +++ b/fog.gemspec @@ -58,6 +58,7 @@ Gem::Specification.new do |s| s.add_dependency("fog-aws", ">= 0.6.0") s.add_dependency("fog-brightbox", "~> 0.4") s.add_dependency("fog-cloudatcost", "~> 0.1.0") + s.add_dependency("fog-dnsimple", "~> 1.0") s.add_dependency("fog-dynect", "~> 0.0.2") s.add_dependency("fog-ecloud", "~> 0.1") s.add_dependency("fog-google", "<= 0.1.0") diff --git a/lib/fog/bin/dnsimple.rb b/lib/fog/bin/dnsimple.rb deleted file mode 100644 index cd6af599bd..0000000000 --- a/lib/fog/bin/dnsimple.rb +++ /dev/null @@ -1,29 +0,0 @@ -class DNSimple < Fog::Bin - class << self - def class_for(key) - case key - when :dns - Fog::DNS::DNSimple - else - raise ArgumentError, "Unrecognized service: #{key}" - end - end - - def [](service) - @@connections ||= Hash.new do |hash, key| - hash[key] = case key - when :dns - Fog::Logger.warning("DNSimple[:dns] is not recommended, use DNS[:dnsimple] for portability") - Fog::DNS.new(:provider => 'DNSimple') - else - raise ArgumentError, "Unrecognized service: #{key.inspect}" - end - end - @@connections[service] - end - - def services - Fog::DNSimple.services - end - end -end diff --git a/lib/fog/dnsimple.rb b/lib/fog/dnsimple.rb deleted file mode 100644 index 69f35f5890..0000000000 --- a/lib/fog/dnsimple.rb +++ /dev/null @@ -1 +0,0 @@ -require 'fog/dnsimple/dns' diff --git a/lib/fog/dnsimple/core.rb b/lib/fog/dnsimple/core.rb deleted file mode 100644 index 6f9d0672eb..0000000000 --- a/lib/fog/dnsimple/core.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'fog/core' -require 'fog/json' - -module Fog - module DNSimple - extend Fog::Provider - - service(:dns, 'DNS') - end -end diff --git a/lib/fog/dnsimple/dns.rb b/lib/fog/dnsimple/dns.rb deleted file mode 100644 index 81120f04f9..0000000000 --- a/lib/fog/dnsimple/dns.rb +++ /dev/null @@ -1,112 +0,0 @@ -require 'fog/dnsimple/core' - -module Fog - module DNS - class DNSimple < Fog::Service - recognizes :dnsimple_email, :dnsimple_password, :dnsimple_token, :dnsimple_domain, :dnsimple_url, :host, :path, :port, :scheme, :persistent - - model_path 'fog/dnsimple/models/dns' - model :record - collection :records - model :zone - collection :zones - - request_path 'fog/dnsimple/requests/dns' - request :list_domains - request :create_domain - request :get_domain - request :delete_domain - request :create_record - request :list_records - request :update_record - request :delete_record - request :get_record - - class Mock - def self.data - @data ||= Hash.new do |hash, key| - hash[key] = { - :domains => [], - :records => {} - } - end - end - - def self.reset - @data = nil - end - - def initialize(options={}) - @dnsimple_email = options[:dnsimple_email] - @dnsimple_password = options[:dnsimple_password] - @dnsimple_token = options[:dnsimple_token] - @dnsimple_domain = options[:dnsimple_domain] - end - - def data - self.class.data[@dnsimple_email] - end - - def reset_data - self.class.data.delete(@dnsimple_email) - end - end - - class Real - def initialize(options={}) - @dnsimple_email = options[:dnsimple_email] - @dnsimple_password = options[:dnsimple_password] - @dnsimple_token = options[:dnsimple_token] - @dnsimple_domain = options[:dnsimple_domain] - @connection_options = options[:connection_options] || {} - if options[:dnsimple_url] - uri = URI.parse(options[:dnsimple_url]) - options[:host] = uri.host - options[:port] = uri.port - options[:scheme] = uri.scheme - end - @host = options[:host] || "api.dnsimple.com" - @persistent = options[:persistent] || false - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) - end - - def reload - @connection.reset - end - - def request(params) - params[:headers] ||= {} - - if(@dnsimple_password) - key = "#{@dnsimple_email}:#{@dnsimple_password}" - params[:headers].merge!("Authorization" => "Basic " + Base64.encode64(key).gsub("\n",'')) - elsif(@dnsimple_token) - if(@dnsimple_domain) - params[:headers].merge!("X-DNSimple-Domain-Token" => @dnsimple_token) - else - params[:headers].merge!("X-DNSimple-Token" => "#{@dnsimple_email}:#{@dnsimple_token}") - end - else - raise ArgumentError.new("Insufficient credentials to properly authenticate!") - end - params[:headers].merge!( - "Accept" => "application/json", - "Content-Type" => "application/json" - ) - - version = params.delete(:version) || 'v1' - params[:path] = File.join('/', version, params[:path]) - - response = @connection.request(params) - - unless response.body.empty? - response.body = Fog::JSON.decode(response.body) - end - response - end - end - end - end -end diff --git a/lib/fog/dnsimple/models/dns/record.rb b/lib/fog/dnsimple/models/dns/record.rb deleted file mode 100644 index 779e68d488..0000000000 --- a/lib/fog/dnsimple/models/dns/record.rb +++ /dev/null @@ -1,63 +0,0 @@ -require 'fog/core/model' - -module Fog - module DNS - class DNSimple - class Record < Fog::Model - extend Fog::Deprecation - deprecate :ip, :value - deprecate :ip=, :value= - - identity :id - - attribute :zone_id, :aliases => "domain_id" - attribute :name - attribute :value, :aliases => "content" - attribute :ttl - attribute :priority, :aliases => "prio" - attribute :type, :aliases => "record_type" - attribute :created_at - attribute :updated_at - - def initialize(attributes={}) - super - end - - def destroy - service.delete_record(zone.id, identity) - true - end - - def zone - @zone - end - - def save - requires :name, :type, :value - options = {} - options[:prio] = priority if priority - options[:ttl] = ttl if ttl - - # decide whether its a new record or update of an existing - if id.nil? - data = service.create_record(zone.id, name, type, value, options) - else - options[:name] = name if name - options[:content] = value if value - options[:type] = type if type - data = service.update_record(zone.id, id, options) - end - - merge_attributes(data.body["record"]) - true - end - - private - - def zone=(new_zone) - @zone = new_zone - end - end - end - end -end diff --git a/lib/fog/dnsimple/models/dns/records.rb b/lib/fog/dnsimple/models/dns/records.rb deleted file mode 100644 index 496c7c5625..0000000000 --- a/lib/fog/dnsimple/models/dns/records.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'fog/core/collection' -require 'fog/dnsimple/models/dns/record' - -module Fog - module DNS - class DNSimple - class Records < Fog::Collection - attribute :zone - - model Fog::DNS::DNSimple::Record - - def all - requires :zone - clear - data = service.list_records(zone.id).body.map {|record| record['record']} - load(data) - end - - def get(record_id) - requires :zone - data = service.get_record(zone.id, record_id).body["record"] - new(data) - rescue Excon::Errors::NotFound - nil - end - - def new(attributes = {}) - requires :zone - super({ :zone => zone }.merge!(attributes)) - end - end - end - end -end diff --git a/lib/fog/dnsimple/models/dns/zone.rb b/lib/fog/dnsimple/models/dns/zone.rb deleted file mode 100644 index 101dc96321..0000000000 --- a/lib/fog/dnsimple/models/dns/zone.rb +++ /dev/null @@ -1,46 +0,0 @@ -require 'fog/core/model' -require 'fog/dnsimple/models/dns/records' - -module Fog - module DNS - class DNSimple - class Zone < Fog::Model - identity :id - - attribute :domain, :aliases => 'name' - attribute :created_at - attribute :updated_at - - def destroy - service.delete_domain(identity) - true - end - - def records - @records ||= begin - Fog::DNS::DNSimple::Records.new( - :zone => self, - :service => service - ) - end - end - - def nameservers - [ - "ns1.dnsimple.com", - "ns2.dnsimple.com", - "ns3.dnsimple.com", - "ns4.dnsimple.com", - ] - end - - def save - requires :domain - data = service.create_domain(domain).body["domain"] - merge_attributes(data) - true - end - end - end - end -end diff --git a/lib/fog/dnsimple/models/dns/zones.rb b/lib/fog/dnsimple/models/dns/zones.rb deleted file mode 100644 index c3b4937896..0000000000 --- a/lib/fog/dnsimple/models/dns/zones.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'fog/core/collection' -require 'fog/dnsimple/models/dns/zone' - -module Fog - module DNS - class DNSimple - class Zones < Fog::Collection - model Fog::DNS::DNSimple::Zone - - def all - clear - data = service.list_domains.body.map {|zone| zone['domain']} - load(data) - end - - def get(zone_id) - data = service.get_domain(zone_id).body['domain'] - new(data) - rescue Excon::Errors::NotFound - nil - end - end - end - end -end diff --git a/lib/fog/dnsimple/requests/dns/create_domain.rb b/lib/fog/dnsimple/requests/dns/create_domain.rb deleted file mode 100644 index 4311e6a923..0000000000 --- a/lib/fog/dnsimple/requests/dns/create_domain.rb +++ /dev/null @@ -1,62 +0,0 @@ -module Fog - module DNS - class DNSimple - class Real - # Create a single domain in DNSimple in your account. - # - # ==== Parameters - # * name<~String> - domain name to host (ie example.com) - # - # ==== Returns - # * response<~Excon::Response>: - # * body<~Hash>: - # * 'domain'<~Hash> The representation of the domain. - def create_domain(name) - body = { - "domain" => { - "name" => name - } - } - - request( - :body => Fog::JSON.encode(body), - :expects => 201, - :method => 'POST', - :path => "/domains" - ) - end - end - - class Mock - def create_domain(name) - body = { - "domain" => { - "id" => Fog::Mock.random_numbers(1).to_i, - "user_id" => 1, - "registrant_id" => nil, - "name" => name, - "unicode_name" => name, - "token" => "4fIFYWYiJayvL2tkf_mkBkqC4L+4RtYqDA", - "state" => "registered", - "language" => nil, - "lockable" => true, - "auto_renew" => nil, - "whois_protected" => false, - "record_count" => 0, - "service_count" => 0, - "expires_on" => Date.today + 365, - "created_at" => Time.now.iso8601, - "updated_at" => Time.now.iso8601, - } - } - self.data[:domains] << body - - response = Excon::Response.new - response.status = 201 - response.body = body - response - end - end - end - end -end diff --git a/lib/fog/dnsimple/requests/dns/create_record.rb b/lib/fog/dnsimple/requests/dns/create_record.rb deleted file mode 100644 index ea0e18ca99..0000000000 --- a/lib/fog/dnsimple/requests/dns/create_record.rb +++ /dev/null @@ -1,67 +0,0 @@ -module Fog - module DNS - class DNSimple - class Real - # Create a new host in the specified zone - # - # ==== Parameters - # * domain<~String> - domain name or numeric ID - # * name<~String> - # * type<~String> - # * content<~String> - # * options<~Hash> - optional - # * priority<~Integer> - # * ttl<~Integer> - # - # ==== Returns - # * response<~Excon::Response>: - # * body<~Hash>: - # * 'record'<~Hash> The representation of the record. - def create_record(domain, name, type, content, options = {}) - body = { - "record" => { - "name" => name, - "record_type" => type, - "content" => content - } - } - - body["record"].merge!(options) - - request( - :body => Fog::JSON.encode(body), - :expects => 201, - :method => 'POST', - :path => "/domains/#{domain}/records" - ) - end - end - - class Mock - def create_record(domain, name, type, content, options = {}) - body = { - "record" => { - "id" => Fog::Mock.random_numbers(1).to_i, - "domain_id" => domain, - "name" => name, - "content" => content, - "ttl" => 3600, - "prio" => nil, - "record_type" => type, - "system_record" => nil, - "created_at" => Time.now.iso8601, - "updated_at" => Time.now.iso8601, - }.merge(options) - } - self.data[:records][domain] ||= [] - self.data[:records][domain] << body - - response = Excon::Response.new - response.status = 201 - response.body = body - response - end - end - end - end -end diff --git a/lib/fog/dnsimple/requests/dns/delete_domain.rb b/lib/fog/dnsimple/requests/dns/delete_domain.rb deleted file mode 100644 index ab0fce60f7..0000000000 --- a/lib/fog/dnsimple/requests/dns/delete_domain.rb +++ /dev/null @@ -1,35 +0,0 @@ -module Fog - module DNS - class DNSimple - class Real - # Delete the given domain from your account. You may use - # either the domain ID or the domain name. - # - # Please note that for domains which are registered with - # DNSimple this will not delete the domain from the registry. - # - # ==== Parameters - # * domain<~String> - domain name or numeric ID - # - def delete_domain(domain) - request( - :expects => 200, - :method => 'DELETE', - :path => "/domains/#{domain}" - ) - end - end - - class Mock - def delete_domain(name) - self.data[:records].delete name - self.data[:domains].reject! { |domain| domain["domain"]["name"] == name } - - response = Excon::Response.new - response.status = 200 - response - end - end - end - end -end diff --git a/lib/fog/dnsimple/requests/dns/delete_record.rb b/lib/fog/dnsimple/requests/dns/delete_record.rb deleted file mode 100644 index 10ad19656b..0000000000 --- a/lib/fog/dnsimple/requests/dns/delete_record.rb +++ /dev/null @@ -1,30 +0,0 @@ -module Fog - module DNS - class DNSimple - class Real - # Delete the record with the given ID for the given domain. - # - # ==== Parameters - # * domain<~String> - domain name or numeric ID - # * record_id<~String> - def delete_record(domain, record_id) - request( - :expects => 200, - :method => "DELETE", - :path => "/domains/#{domain}/records/#{record_id}" - ) - end - end - - class Mock - def delete_record(domain, record_id) - self.data[:records][domain].reject! { |record| record["record"]["id"] == record_id } - - response = Excon::Response.new - response.status = 200 - response - end - end - end - end -end diff --git a/lib/fog/dnsimple/requests/dns/get_domain.rb b/lib/fog/dnsimple/requests/dns/get_domain.rb deleted file mode 100644 index 6b2bf61589..0000000000 --- a/lib/fog/dnsimple/requests/dns/get_domain.rb +++ /dev/null @@ -1,39 +0,0 @@ -module Fog - module DNS - class DNSimple - class Real - # Get the details for a specific domain in your account. You - # may pass either the domain numeric ID or the domain name - # itself. - # - # ==== Parameters - # * domain<~String> - domain name or numeric ID - # - # ==== Returns - # * response<~Excon::Response>: - # * body<~Hash>: - # * 'domain'<~Hash> The representation of the domain. - def get_domain(domain) - request( - :expects => 200, - :method => "GET", - :path => "/domains/#{domain}" - ) - end - end - - class Mock - def get_domain(id) - domain = self.data[:domains].find do |domain| - domain["domain"]["id"] == id || domain["domain"]["name"] == id - end - - response = Excon::Response.new - response.status = 200 - response.body = domain - response - end - end - end - end -end diff --git a/lib/fog/dnsimple/requests/dns/get_record.rb b/lib/fog/dnsimple/requests/dns/get_record.rb deleted file mode 100644 index 24b9e5944d..0000000000 --- a/lib/fog/dnsimple/requests/dns/get_record.rb +++ /dev/null @@ -1,49 +0,0 @@ -module Fog - module DNS - class DNSimple - class Real - # Gets record from given domain. - # - # ==== Parameters - # * domain<~String> - domain name or numeric ID - # * record_id<~String> - # - # ==== Returns - # * response<~Excon::Response>: - # * body<~Hash>: - # * 'record'<~Hash> The representation of the record. - def get_record(domain, record_id) - request( - :expects => 200, - :method => "GET", - :path => "/domains/#{domain}/records/#{record_id}" - ) - end - end - - class Mock - def get_record(domain, record_id) - response = Excon::Response.new - - if self.data[:records].key?(domain) - response.status = 200 - response.body = self.data[:records][domain].find { |record| record["record"]["id"] == record_id } - - if response.body.nil? - response.status = 404 - response.body = { - "error" => "Couldn't find Record with id = #{record_id}" - } - end - else - response.status = 404 - response.body = { - "error" => "Couldn't find Domain with name = #{domain}" - } - end - response - end - end - end - end -end diff --git a/lib/fog/dnsimple/requests/dns/list_domains.rb b/lib/fog/dnsimple/requests/dns/list_domains.rb deleted file mode 100644 index 04dcf2ccd2..0000000000 --- a/lib/fog/dnsimple/requests/dns/list_domains.rb +++ /dev/null @@ -1,34 +0,0 @@ -module Fog - module DNS - class DNSimple - class Real - # Get the details for a specific domain in your account. You - # may pass either the domain numeric ID or the domain name itself. - # - # ==== Parameters - # - # ==== Returns - # * response<~Excon::Response>: - # * body<~Hash>: - # * <~Array>: - # * 'domain'<~Hash> The representation of the domain. - def list_domains - request( - :expects => 200, - :method => 'GET', - :path => '/domains' - ) - end - end - - class Mock - def list_domains - response = Excon::Response.new - response.status = 200 - response.body = self.data[:domains] - response - end - end - end - end -end diff --git a/lib/fog/dnsimple/requests/dns/list_records.rb b/lib/fog/dnsimple/requests/dns/list_records.rb deleted file mode 100644 index 7036df4f14..0000000000 --- a/lib/fog/dnsimple/requests/dns/list_records.rb +++ /dev/null @@ -1,34 +0,0 @@ -module Fog - module DNS - class DNSimple - class Real - # Get the list of records for the specific domain. - # - # ==== Parameters - # * domain<~String> - domain name or numeric ID - # - # ==== Returns - # * response<~Excon::Response>: - # * body<~Hash>: - # * <~Array>: - # * 'record'<~Hash> The representation of the record. - def list_records(domain) - request( - :expects => 200, - :method => "GET", - :path => "/domains/#{domain}/records" - ) - end - end - - class Mock - def list_records(domain) - response = Excon::Response.new - response.status = 200 - response.body = self.data[:records][domain] || [] - response - end - end - end - end -end diff --git a/lib/fog/dnsimple/requests/dns/update_record.rb b/lib/fog/dnsimple/requests/dns/update_record.rb deleted file mode 100644 index 3ec518b324..0000000000 --- a/lib/fog/dnsimple/requests/dns/update_record.rb +++ /dev/null @@ -1,53 +0,0 @@ -module Fog - module DNS - class DNSimple - class Real - # Update the given record for the given domain. - # - # ==== Parameters - # * domain<~String> - domain name or numeric ID - # * record_id<~String> - # * options<~Hash> - optional - # * type<~String> - # * content<~String> - # * priority<~Integer> - # * ttl<~Integer> - # - # ==== Returns - # * response<~Excon::Response>: - # * body<~Hash>: - # * 'record'<~Hash> The representation of the record. - def update_record(domain, record_id, options) - body = { - "record" => options - } - - request( - :body => Fog::JSON.encode(body), - :expects => 200, - :method => "PUT", - :path => "/domains/#{domain}/records/#{record_id}" - ) - end - end - - class Mock - def update_record(domain, record_id, options) - record = self.data[:records][domain].find { |record| record["record"]["id"] == record_id } - response = Excon::Response.new - - if record.nil? - response.status = 400 - else - response.status = 200 - record["record"].merge!(options) - record["record"]["updated_at"] = Time.now.iso8601 - response.body = record - end - - response - end - end - end - end -end diff --git a/spec/fog/bin/dnsimple_spec.rb b/spec/fog/bin/dnsimple_spec.rb index 95057aaea5..d9f4272c8b 100644 --- a/spec/fog/bin/dnsimple_spec.rb +++ b/spec/fog/bin/dnsimple_spec.rb @@ -2,8 +2,8 @@ require "fog/bin" require "helpers/bin" -describe DNSimple do +describe Dnsimple do include Fog::BinSpec - let(:subject) { DNSimple } + let(:subject) { Dnsimple } end diff --git a/spec/fog/bin_spec.rb b/spec/fog/bin_spec.rb index 91ee273b96..d27302bd9c 100644 --- a/spec/fog/bin_spec.rb +++ b/spec/fog/bin_spec.rb @@ -13,7 +13,7 @@ assert_equal "CloudSigma", Fog.providers[:cloudsigma] assert_equal "Cloudstack", Fog.providers[:cloudstack] assert_equal "DigitalOcean", Fog.providers[:digitalocean] - assert_equal "DNSimple", Fog.providers[:dnsimple] + assert_equal "Dnsimple", Fog.providers[:dnsimple] assert_equal "DNSMadeEasy", Fog.providers[:dnsmadeeasy] assert_equal "Dreamhost", Fog.providers[:dreamhost] assert_equal "Dynect", Fog.providers[:dynect] @@ -62,7 +62,7 @@ assert_includes Fog.registered_providers, "CloudSigma" assert_includes Fog.registered_providers, "Cloudstack" assert_includes Fog.registered_providers, "DigitalOcean" - assert_includes Fog.registered_providers, "DNSimple" + assert_includes Fog.registered_providers, "Dnsimple" assert_includes Fog.registered_providers, "DNSMadeEasy" assert_includes Fog.registered_providers, "Dreamhost" assert_includes Fog.registered_providers, "Dynect" @@ -111,7 +111,7 @@ assert_includes Fog.available_providers, "CloudSigma" if CloudSigma.available? assert_includes Fog.available_providers, "Cloudstack" if Cloudstack.available? assert_includes Fog.available_providers, "DigitalOcean" if DigitalOcean.available? - assert_includes Fog.available_providers, "DNSimple" if DNSimple.available? + assert_includes Fog.available_providers, "Dnsimple" if Dnsimple.available? assert_includes Fog.available_providers, "DNSMadeEasy" if DNSMadeEasy.available? assert_includes Fog.available_providers, "Dreamhost" if Dreamhost.available? assert_includes Fog.available_providers, "Dynect" if Dynect.available? From be842d09aef076f90154f0b9107edbc11fc12603 Mon Sep 17 00:00:00 2001 From: Joshua Lane Date: Tue, 14 Feb 2017 09:53:33 -0800 Subject: [PATCH 2/2] remove dnsimple tests. fog now relies upon fog-dnsimple, which has it's own tests. --- tests/dnsimple/requests/dns/dns_tests.rb | 122 ----------------------- 1 file changed, 122 deletions(-) delete mode 100644 tests/dnsimple/requests/dns/dns_tests.rb diff --git a/tests/dnsimple/requests/dns/dns_tests.rb b/tests/dnsimple/requests/dns/dns_tests.rb deleted file mode 100644 index 0827d0e1ab..0000000000 --- a/tests/dnsimple/requests/dns/dns_tests.rb +++ /dev/null @@ -1,122 +0,0 @@ -Shindo.tests('Fog::DNS[:dnsimple] | DNS requests', ['dnsimple', 'dns']) do - - @domain = nil - @domain_count = 0 - - tests("success") do - - test("get current domain count") do - response = Fog::DNS[:dnsimple].list_domains() - if response.status == 200 - @domain_count = response.body.size - end - - response.status == 200 - end - - test("create domain") do - domain = generate_unique_domain - response = Fog::DNS[:dnsimple].create_domain(domain) - if response.status == 201 - @domain = response.body["domain"] - end - - response.status == 201 - end - - test("get domain by id") do - response = Fog::DNS[:dnsimple].get_domain(@domain["id"]) - response.status == 200 - end - - test("create an A resource record") do - domain = @domain["name"] - name = "www" - type = "A" - content = "1.2.3.4" - response = Fog::DNS[:dnsimple].create_record(domain, name, type, content) - - if response.status == 201 - @record = response.body["record"] - end - - response.status == 201 - - end - - test("create a MX record") do - domain = @domain["name"] - name = "" - type = "MX" - content = "mail.#{domain}" - options = { "ttl" => 60, "prio" => 10 } - response = Fog::DNS[:dnsimple].create_record(domain, name, type, content, options) - - test "MX record creation returns 201" do - response.status == 201 - end - - options.each do |key, value| - test("MX record has option #{key}") { value == response.body["record"][key.to_s] } - end - - test "MX record is correct type" do - response.body["record"]["record_type"] == "MX" - end - end - - test("get a record") do - domain = @domain["name"] - record_id = @record["id"] - - response = Fog::DNS[:dnsimple].get_record(domain, record_id) - - (response.status == 200) and (@record == response.body["record"]) - end - - test("update a record") do - domain = @domain["name"] - record_id = @record["id"] - options = { "content" => "2.3.4.5", "ttl" => 600 } - response = Fog::DNS[:dnsimple].update_record(domain, record_id, options) - response.status == 200 - end - - test("list records") do - response = Fog::DNS[:dnsimple].list_records(@domain["name"]) - - if response.status == 200 - @records = response.body - end - - test "list records returns all records for domain" do - @records.reject { |record| record["record"]["system_record"] }.size == 2 - end - - response.status == 200 - end - - test("delete records") do - domain = @domain["name"] - - result = true - @records.each do |record| - next if record["record"]["system_record"] - response = Fog::DNS[:dnsimple].delete_record(domain, record["record"]["id"]) - if response.status != 200 - result = false - break - end - end - - result - end - - test("delete domain") do - response = Fog::DNS[:dnsimple].delete_domain(@domain["name"]) - response.status == 200 - end - - end - -end