test/plugin/test_slack_client.rb in fluent-plugin-slack-0.5.1 vs test/plugin/test_slack_client.rb in fluent-plugin-slack-0.5.2
- old
+ new
@@ -15,10 +15,11 @@
class SlackClientTest < Test::Unit::TestCase
def setup
super
@incoming_webhook = Fluent::SlackClient::IncomingWebhook.new(ENV['WEBHOOK_URL'])
@api = Fluent::SlackClient::WebApi.new
+ @icon_url = 'http://www.google.com/s2/favicons?domain=www.google.de'
end
def token(client)
client == @api ? {token: ENV['TOKEN']} : {}
end
@@ -40,30 +41,21 @@
)
end
end
end
- def test_post_message_fields
+ def test_post_message_icon_url
[@incoming_webhook, @api].each do |slack|
assert_nothing_raised do
slack.post_message(
{
channel: '#general',
username: 'fluentd',
- icon_emoji: ':question:',
+ icon_url: @icon_url,
attachments: [{
color: 'good',
- fallback: 'test1 test2',
- fields: [
- {
- title: 'test1',
- value: "[07:00:00] sowawa1\n[07:00:00] sowawa2\n",
- },
- {
- title: 'test2',
- value: "[07:00:00] sowawa1\n[07:00:00] sowawa2\n",
- },
- ],
+ fallback: "sowawa1\nsowawa2\n",
+ text: "sowawa1\nsowawa2\n",
}]
}.merge(token(slack))
)
end
end