Sha256: 89eb073aacc8688248b5c0ddf2dfa9b72d8e41997a41c93ff09ff5b1d47273dc

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

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

# Test class for Record Set Collection
class TestRecordSets < Minitest::Test
  def setup
    @service = Fog::DNS::AzureRM.new(credentials)
    @record_sets = Fog::DNS::AzureRM::RecordSets.new(resource_group: 'fog-test-rg', zone_name: 'fog-test-zone.com', type: 'A', service: @service)
    @response = [ApiStub::Models::DNS::RecordSet.list_record_sets]
  end

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

  def test_collection_attributes
    assert @record_sets.respond_to? :resource_group, true
    assert @record_sets.respond_to? :zone_name, true
    assert @record_sets.respond_to? :type, true
  end

  def test_all_method_response
    @service.stub :list_record_sets, @response do
      assert_instance_of Fog::DNS::AzureRM::RecordSets, @record_sets.all
      assert @record_sets.all.size >= 1
      @record_sets.all.each do |s|
        assert_instance_of Fog::DNS::AzureRM::RecordSet, s
      end
    end
  end

  def test_all_method_name_response
    name_response = ApiStub::Models::DNS::RecordSet.list_record_sets
    name_response['name'] = '@'
    response = [name_response]
    @service.stub :list_record_sets, response do
      assert_instance_of Fog::DNS::AzureRM::RecordSets, @record_sets.all
    end
  end

  def test_get_method_response
    response = ApiStub::Models::DNS::RecordSet.create_record_set_obj
    @service.stub :get_record_set, response do
      assert_instance_of Fog::DNS::AzureRM::RecordSet, @record_sets.get('fog-test-rg', 'fog-test-record-set', 'fog-test-zone', 'A')
    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_record_sets.rb
fog-azure-rm-0.0.6 test/models/dns/test_record_sets.rb
fog-azure-rm-0.0.5 test/models/dns/test_record_sets.rb