Sha256: fbed11bee63ab54fb96b3de543e00461bee8c274bbc6f21d9696e6b81197f1f4

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

require File.expand_path '../../test_helper', __dir__

# Test class for Zone Collection
class TestZones < Minitest::Test
  def setup
    @service = Fog::DNS::AzureRM.new(credentials)
    @zones = Fog::DNS::AzureRM::Zones.new(service: @service)
    @response = [ApiStub::Models::DNS::Zone.list_zones]
  end

  def test_collection_methods
    methods = [
      :all,
      :get,
      :check_for_zone
    ]
    methods.each do |method|
      assert @zones.respond_to? method, true
    end
  end

  def test_all_method_response
    @service.stub :list_zones, @response do
      assert_instance_of Fog::DNS::AzureRM::Zones, @zones.all
      assert @zones.all.size >= 1
      @zones.all.each do |s|
        assert_instance_of Fog::DNS::AzureRM::Zone, s
      end
    end
  end

  def test_get_method_response
    response = ApiStub::Models::DNS::Zone.create_zone_obj
    @service.stub :get_zone, response do
      assert_instance_of Fog::DNS::AzureRM::Zone, @zones.get('fog-test-rg', 'fog-test-zone.com')
    end
  end

  def test_check_for_zone_true_response
    @service.stub :check_for_zone, true do
      assert @zones.check_for_zone('fog-test-rg', 'fog-test-zone.com')
    end
  end

  def test_check_for_zone_false_response
    @service.stub :check_for_zone, false do
      assert !@zones.check_for_zone('fog-test-rg', 'fog-test-zone.com')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.8 test/models/dns/test_zones.rb
fog-azure-rm-0.0.6 test/models/dns/test_zones.rb
fog-azure-rm-0.0.5 test/models/dns/test_zones.rb