Sha256: 5ea67eee1e3bb2c1d6ff9550e84a6780801a9036d49fb71c847133de548e1bf2

Contents?: true

Size: 1.47 KB

Versions: 3

Compression:

Stored size: 1.47 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)
    @dns_client1 = @service.instance_variable_get(:@dns_client)
    @response = [ApiStub::Models::DNS::Zone.create_zone_obj(@dns_client1)]
  end

  def test_collection_methods
    methods = [
      :all,
      :get,
      :check_for_zone
    ]
    methods.each do |method|
      assert_respond_to @zones, method
    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(@dns_client1)
    @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.1.1 test/models/dns/test_zones.rb
fog-azure-rm-0.1.0 test/models/dns/test_zones.rb
fog-azure-rm-0.0.9 test/models/dns/test_zones.rb