Sha256: 47897f29687a64ee74a7c2fec259e179c68e1caa01e5d9bbe5f50893eff5716c
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
require 'test_helper' require 'fluent/plugin/out_buffered_slack' require 'time' class BufferedSlackOutputTest < Test::Unit::TestCase def setup super Fluent::Test.setup end CONFIG = %[ type buffered_slack api_key testtoken team sowasowa channel test username testuser color good icon_emoji :ghost: compress gz buffer_path ./test/tmp utc ] def create_driver(conf = CONFIG) Fluent::Test::BufferedOutputTestDriver.new(Fluent::BufferedSlackOutput).configure(conf) end def test_format d = create_driver time = Time.parse("2014-01-01 22:00:00 UTC").to_i d.tag = 'test' stub(d.instance.slack).say( nil, channel: '#test', username: 'testuser', icon_emoji: ':ghost:', attachments: [{ fallback: d.tag, color: 'good', fields: [ { title: d.tag, value: "[#{Time.at(time)}] sowawa\n" }]}]) d.emit({message: 'sowawa'}, time) d.expect_format %[#{['test', time, {message: 'sowawa'}].to_msgpack}] d.run end def test_write d = create_driver time = Time.parse("2014-01-01 22:00:00 UTC").to_i d.tag = 'test' stub(d.instance.slack).say( nil, channel: '#test', username: 'testuser', icon_emoji: ':ghost:', attachments: [{ fallback: d.tag, color: 'good', fields: [ { title: d.tag, value: "[#{Time.at(time)}] sowawa1\n" + "[#{Time.at(time)}] sowawa2\n" }]}]) d.emit({message: 'sowawa1'}, time) d.emit({message: 'sowawa2'}, time) d.run end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-slack-0.1.0 | test/plugin/out_buffered_slack.rb |