Sha256: 8fcaab56a5b2b3f417ad0a131202f5a73b998254fd8e84f70e20e2e59cbf5ecd

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

require 'helper'

class TwitterInputTest < Test::Unit::TestCase
  def setup
    Fluent::Test.setup
  end

  CONFIG = %[
    consumer_key        CONSUMER_KEY
    consumer_secret     CONSUMER_SECRET
    oauth_token         OAUTH_TOKEN
    oauth_token_secret  OAUTH_TOKEN_SECRET
    tag                 input.twitter
    timeline            sampling
  ]

  def create_driver(conf=CONFIG,tag='test')
    Fluent::Test::OutputTestDriver.new(Fluent::TwitterInput, tag).configure(conf)
  end

  def test_configure
    assert_raise(Fluent::ConfigError) {
      d = create_driver('')
    }
    d = create_driver %[
      consumer_key        CONSUMER_KEY
      consumer_secret     CONSUMER_SECRET
      oauth_token         OAUTH_TOKEN
      oauth_token_secret  OAUTH_TOKEN_SECRET
      tag                 input.twitter
      timeline            sampling
      keyword             ${hashtag}ruby lang:ja "happy hour" :)
    ]
    assert_equal 'CONSUMER_KEY', d.instance.consumer_key
    assert_equal 'CONSUMER_SECRET', d.instance.consumer_secret
    assert_equal 'OAUTH_TOKEN', d.instance.oauth_token
    assert_equal 'OAUTH_TOKEN_SECRET', d.instance.oauth_token_secret
    assert_equal '#ruby lang:ja "happy hour" :)', d.instance.keyword
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fluent-plugin-twitter-0.3.2 test/plugin/test_in_twitter.rb
fluent-plugin-twitter-0.3.1 test/plugin/test_in_twitter.rb
fluent-plugin-twitter-0.3.0 test/plugin/test_in_twitter.rb