test/plugin/test_out_slack.rb in fluent-plugin-slack-0.6.0 vs test/plugin/test_out_slack.rb in fluent-plugin-slack-0.6.1
- old
+ new
@@ -244,9 +244,26 @@
d = create_driver(CONFIG + %[https_proxy https://proxy.foo.bar:443])
assert_equal URI.parse('https://proxy.foo.bar:443'), d.instance.slack.https_proxy
assert_not_equal Net::HTTP, d.instance.slack.proxy_class # Net::HTTP.Proxy
end
+ def test_auto_channels_create_configure
+ # default
+ d = create_driver(CONFIG)
+ assert_equal false, d.instance.auto_channels_create
+ assert_equal({}, d.instance.post_message_opts)
+
+ # require `token`
+ assert_raise(Fluent::ConfigError) do
+ d = create_driver(CONFIG + %[auto_channels_create true])
+ end
+
+ # auto_channels_create
+ d = create_driver(CONFIG + %[auto_channels_create true\ntoken XXX-XX-XXX])
+ assert_equal true, d.instance.auto_channels_create
+ assert_equal({auto_channels_create: true}, d.instance.post_message_opts)
+ end
+
def test_default_incoming_webhook
d = create_driver(%[
channel channel
webhook_url https://hooks.slack.com/services/XXX/XXX/XXX
])