Sha256: f3eb23dfae1ebca2a0a9c2371e209f2f98a23b2c05ab6659823c0453a6be434e

Contents?: true

Size: 1.94 KB

Versions: 77

Compression:

Stored size: 1.94 KB

Contents

require 'test_helper'

module Elasticsearch
  module Test
    class IndicesPutMappingTest < ::Test::Unit::TestCase

      context "Indices: Put mapping" do
        subject { FakeClient.new }

        should "require the :type argument" do
          assert_raise ArgumentError do
            subject.indices.put_mapping :index => 'foo', :body => {}
          end
        end

        should "perform correct request" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'PUT', method
            assert_equal 'foo/_mapping/bar', url
            assert_equal Hash.new, params
            assert_equal({ :foo => {} }, body)
            true
          end.returns(FakeResponse.new)

          subject.indices.put_mapping :index => 'foo', :type => 'bar', :body => { :foo => {} }
        end

        should "perform request against multiple indices" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'foo,bar/_mapping/bam', url
            true
          end.returns(FakeResponse.new)

          subject.indices.put_mapping :index => ['foo','bar'], :type => 'bam', :body => {}
        end

        should "pass the URL parameters" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'foo/_mapping/bar', url
            assert_equal true, params[:ignore_conflicts]
            true
          end.returns(FakeResponse.new)

          subject.indices.put_mapping :index => 'foo', :type => 'bar', :body => {}, :ignore_conflicts => true
        end

        should "URL-escape the parts" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'foo%5Ebar/_mapping/bar%2Fbam', url
            true
          end.returns(FakeResponse.new)

          subject.indices.put_mapping :index => 'foo^bar', :type => 'bar/bam', :body => {}
        end

      end

    end
  end
end

Version data entries

77 entries across 77 versions & 6 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/indices/put_mapping_test.rb