2018-01-06 12:11:44 +01:00
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
|
|
|
class IntercomWebHookTests(WebhookTestCase):
|
|
|
|
STREAM_NAME = 'test'
|
|
|
|
URL_TEMPLATE = "/api/v1/external/intercom?&api_key={api_key}&stream={stream}"
|
|
|
|
FIXTURE_DIR_NAME = 'intercom'
|
|
|
|
|
|
|
|
def test_user_created_message(self) -> None:
|
2018-11-09 20:33:58 +01:00
|
|
|
expected_topic = u"user tag created"
|
2018-01-06 12:11:44 +01:00
|
|
|
expected_message = ('*10:43:22 2017-12-17* **user tag created**: \n'
|
|
|
|
' - User Name: John Doe\n'
|
|
|
|
' - User Email: john.doe@gmail.com\n'
|
|
|
|
' - User Phone: 9876543211')
|
|
|
|
|
2018-11-09 20:33:58 +01:00
|
|
|
self.send_and_test_stream_message('user_created', expected_topic, expected_message,
|
2018-01-06 12:11:44 +01:00
|
|
|
content_type="application/x-www-form-urlencoded")
|
|
|
|
|
2018-05-10 19:34:01 +02:00
|
|
|
def get_body(self, fixture_name: str) -> str:
|
2018-04-20 03:57:21 +02:00
|
|
|
return self.webhook_fixture_data('intercom', fixture_name, file_type="json")
|