Sha256: d9b3d4c79674a3b82e2b8cfd266fcf4628276d948bfb7bfa22340b9c18186157

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

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

# Test class for List Record Sets Request
class TestListRecordSets < Minitest::Test
  def setup
    @service = Fog::DNS::AzureRM.new(credentials)
    @record_sets = @service.record_sets
    @token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
  end

  def test_list_record_sets_success
    response = ApiStub::Requests::DNS::RecordSet.list_record_sets_response
    @token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
      RestClient.stub :get, response do
        assert_equal @service.list_record_sets('fog-test-rg', 'fog-test-zone'), JSON.parse(response)['value']
      end
    end
  end

  def test_list_record_sets_failure
    @token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
      assert_raises ArgumentError do
        @service.list_record_sets('fog-test-rg')
      end
    end
  end

  def test_list_record_sets_exception
    response = -> { fail Exception.new('mocked exception') }
    @token_provider.stub :get_authentication_header, response do
      assert_raises Exception do
        @service.list_record_sets('fog-test-rg', 'fog-test-zone')
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.8 test/requests/dns/test_list_record_sets.rb
fog-azure-rm-0.0.6 test/requests/dns/test_list_record_sets.rb
fog-azure-rm-0.0.5 test/requests/dns/test_list_record_sets.rb
fog-azure-rm-0.0.4 test/requests/dns/test_list_record_sets.rb