mirror of
https://github.com/home-assistant/core.git
synced 2026-09-24 07:25:52 -05:00
Add Slack thread/reply support (#93384)
This commit is contained in:
@@ -6,6 +6,7 @@ from unittest.mock import AsyncMock, Mock
|
||||
from homeassistant.components import notify
|
||||
from homeassistant.components.slack import DOMAIN
|
||||
from homeassistant.components.slack.notify import (
|
||||
ATTR_THREAD_TS,
|
||||
CONF_DEFAULT_CHANNEL,
|
||||
SlackNotificationService,
|
||||
)
|
||||
@@ -93,3 +94,18 @@ async def test_message_icon_url_overrides_default() -> None:
|
||||
mock_fn.assert_called_once()
|
||||
_, kwargs = mock_fn.call_args
|
||||
assert kwargs["icon_url"] == expected_icon
|
||||
|
||||
|
||||
async def test_message_as_reply() -> None:
|
||||
"""Tests that a message pointer will be passed to Slack if specified."""
|
||||
mock_client = Mock()
|
||||
mock_client.chat_postMessage = AsyncMock()
|
||||
service = SlackNotificationService(None, mock_client, CONF_DATA)
|
||||
|
||||
expected_ts = "1624146685.064129"
|
||||
await service.async_send_message("test", data={ATTR_THREAD_TS: expected_ts})
|
||||
|
||||
mock_fn = mock_client.chat_postMessage
|
||||
mock_fn.assert_called_once()
|
||||
_, kwargs = mock_fn.call_args
|
||||
assert kwargs["thread_ts"] == expected_ts
|
||||
|
||||
Reference in New Issue
Block a user