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):
|
|
|
|
STREAM_NAME = 'test'
|
|
|
|
URL_TEMPLATE = "/api/v1/external/mention?api_key={api_key}&stream={stream}"
|
|
|
|
FIXTURE_DIR_NAME = 'mention'
|
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_mention_webfeed(self) -> None:
|
2020-04-09 21:51:58 +02:00
|
|
|
expected_topic = "news"
|
2019-05-09 03:48:17 +02:00
|
|
|
expected_message = """
|
|
|
|
**[Historical Sexual Abuse (Football): 29 Nov 2016: House of Commons debates - TheyWorkForYou](https://www.theyworkforyou.com/debates/?id=2016-11-29b.1398.7&p=24887)**:
|
|
|
|
|
|
|
|
``` quote
|
|
|
|
\u2026 Culture, Media and Sport\nNothing is more important than keeping children safe. Child sex abuse is an exceptionally vile crime, and all of Government take it very seriously indeed, as I know this House does.
|
|
|
|
Children up and down the country are \u2026
|
|
|
|
```
|
|
|
|
""".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",
|
|
|
|
expected_topic,
|
|
|
|
expected_message,
|
|
|
|
content_type="application/x-www-form-urlencoded",
|
|
|
|
)
|