Sha256: d59ad340df10adbcc7b1b96b01b4b9c792bbc4b728b1d9b5c1fabb476430f4d4

Contents?: true

Size: 1.94 KB

Versions: 8

Compression:

Stored size: 1.94 KB

Contents

require 'rubygems'
require 'shindo'

require File.join(File.dirname(__FILE__), '..', 'lib', 'fog')
require File.join(File.dirname(__FILE__), '..', 'tests', 'helper')

Shindo.tests('dns tests', 'dns') do

  # iterate over all the providers
  Fog.providers.each do |provider|

    # skip if provider does not have storage
    next unless provider.respond_to?(:services) && provider.services.include?(:dns)

    tests(provider, provider.to_s.downcase) do

      # use shortcuts to instantiate connection
      @dns = Fog::DNS.new(:provider => provider.to_s)

      # create a zone
      #   domain should be the hostname
      #   email is only required for linode, but included for consistency
      tests('@zone = @dns.zones.create').succeeds do
        @zone = @dns.zones.create(
          :domain => 'fogdnsexamples.com',
          :email => 'tests@fogdnsexamples.com'
        )
      end

      # create a record in the zone
      #   ip is the address to route to
      #   name is the name for the record
      #   type is the type of record to create
      tests('@record = @zone.records.create').succeeds do
        @record = @zone.records.create(
          :ip => '1.2.3.4',
          :name => 'www.fogdnsexamples.com',
          :type => 'A'
        )
      end

      # list zones
      tests('@zones = @dns.zones').succeeds do
        @zones = @dns.zones
      end

      # get a zone
      tests('@dns.zones.get(@zone.identity)').succeeds do
        @dns.zones.get(@zone.identity)
      end

      # list records
      tests('@records = @zone.records').succeeds do
        @records = @zone.records
      end

      # get a record
      tests('@zone.records.get(@record.identity)').succeeds do
        @zone.records.get(@record.identity)
      end

      # destroy the record
      tests('@record.destroy').succeeds do
        @record.destroy
      end

      # destroy the zone
      tests('@zone.destroy').succeeds do
        @zone.destroy
      end

    end

  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
fog-0.5.1 examples/dns_tests.rb
fog-0.5.0 examples/dns_tests.rb
phpfog-fog-0.4.1.3 examples/dns_tests.rb
phpfog-fog-0.4.1.2 examples/dns_tests.rb
phpfog-fog-0.4.1.1 examples/dns_tests.rb
phpfog-fog-0.4.1 examples/dns_tests.rb
fog-0.4.1 examples/dns_tests.rb
fog-0.4.0 examples/dns_tests.rb