2016-12-04 02:50:29 +01:00
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
2020-01-14 22:06:24 +01:00
|
|
|
|
2016-12-04 02:50:29 +01:00
|
|
|
class MentionHookTests(WebhookTestCase):
|
2024-05-04 22:02:50 +02:00
|
|
|
CHANNEL_NAME = "test"
|
2016-12-04 02:50:29 +01:00
|
|
|
URL_TEMPLATE = "/api/v1/external/mention?api_key={api_key}&stream={stream}"
|
2021-06-26 09:18:33 +02:00
|
|
|
WEBHOOK_DIR_NAME = "mention"
|
2016-12-04 02:50:29 +01:00
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_mention_webfeed(self) -> None:
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "news"
|
2019-05-09 03:48:17 +02:00
|
|
|
expected_message = """
|
2024-11-19 09:58:19 +01:00
|
|
|
**[Travel Industry Sees Surge in Eco-Tourism (Travel): 29 Nov 2024: Global Tourism - TheyWorkForYou](https://www.theyworkforyou.com/debates/?id=2016-11-29b.1398.7&p=24887)**:
|
2019-05-09 03:48:17 +02:00
|
|
|
|
|
|
|
``` quote
|
2024-11-19 09:58:19 +01:00
|
|
|
\u2026 Tourism, Culture and Heritage\nMore travelers prioritize environmental sustainability, driving growth in eco-friendly accommodations and activities. Popular destinations include Costa Rica and \u2026
|
2019-05-09 03:48:17 +02:00
|
|
|
```
|
|
|
|
""".strip()
|
2016-12-04 02:50:29 +01:00
|
|
|
|
|
|
|
# use fixture named mention_webfeeds
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"webfeeds",
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name,
|
2020-08-23 15:49:24 +02:00
|
|
|
expected_message,
|
|
|
|
content_type="application/x-www-form-urlencoded",
|
|
|
|
)
|