Sha256: b05a6e36f3b4654a6f1868c0ee4a7558537d7874442d2ddcddfa47a2926c1c58

Contents?: true

Size: 1.54 KB

Versions: 45

Compression:

Stored size: 1.54 KB

Contents

require 'test_helper'

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

      context "Delete by query" do
        subject { FakeClient.new }

        should "require the :index argument" do
          assert_raise ArgumentError do
            subject.delete_by_query :body => {}
          end
        end

        should "perform correct request" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'POST', method
            assert_equal 'foo/_delete_by_query', url
            assert_equal Hash.new, params
            assert_equal Hash.new, body[:term]
            true
          end.returns(FakeResponse.new)

          subject.delete_by_query :index => 'foo', :body => { :term => {} }
        end

        should "optionally take the :type argument" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'foo/tweet,post/_delete_by_query', url
            true
          end.returns(FakeResponse.new)

          subject.delete_by_query :index => 'foo', :type => ['tweet', 'post'], :body => { :term => {} }
        end

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

          subject.delete_by_query :index => 'foo', :q => 'foo:bar'
        end

      end

    end
  end
end

Version data entries

45 entries across 45 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/delete_by_query_test.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/elasticsearch-api-5.0.5/test/unit/delete_by_query_test.rb