Kouhei Sutou
null+****@clear*****
Thu Mar 28 16:46:08 JST 2013
Kouhei Sutou 2013-03-28 16:46:08 +0900 (Thu, 28 Mar 2013) New Revision: 96fee928608ad9778836524da68a9433e1368c94 https://github.com/groonga/fluent-plugin-droonga/commit/96fee928608ad9778836524da68a9433e1368c94 Message: Add a missing test Oh... Modified files: test/test_output.rb Modified: test/test_output.rb (+52 -1) =================================================================== --- test/test_output.rb 2013-03-28 16:41:24 +0900 (d0f72a7) +++ test/test_output.rb 2013-03-28 16:46:08 +0900 (b159d8b) @@ -32,8 +32,25 @@ module OutputStub end end + class Logger + attr_reader :tag, :options + attr_reader :posted_tag, :posted_message + def initialize(tag, options) + @tag = tag + @options = options + end + + def post(tag, message) + @posted_tag = tag + @posted_message = message + end + + def close + end + end + class Output < Fluent::DroongaOutput - attr_reader :worker + attr_reader :worker, :outputs def initialize(response) @response = response super() @@ -42,6 +59,10 @@ module OutputStub def create_worker Worker.new(@response) end + + def create_logger(tag, options) + Logger.new(tag, options) + end end end @@ -62,6 +83,36 @@ class OutputTest < Test::Unit::TestCase assert_equal(request, @output.worker.processed_record) end + def test_replyTo + response = {} + driver = create_driver("droonga.message", response) + request = { + "id" => "29", + "replyTo" => "127.0.0.1:2929/droonga.meessage", + "type" => "search", + } + time = Time.parse("2012-10-26T08:45:42Z").to_i + driver.run do + driver.emit(request, time) + end + + response_output =****@outpu*****["127.0.0.1:2929"] + response_logger = response_output[:logger] + assert_equal([ + "message", + { + :body => {:result => {}}, + :inReplyTo => "29", + :statusCode => 200, + :type => "search.result", + }, + ], + [ + response_logger.posted_tag, + response_logger.posted_message, + ]) + end + private def create_driver(tag, response) @output = OutputStub::Output.new(response) -------------- next part -------------- HTML����������������������������...下载