mirror of https://github.com/zulip/zulip.git
130 lines
5.4 KiB
Python
130 lines
5.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
|
class RaygunHookTests(WebhookTestCase):
|
|
STREAM_NAME = 'raygun'
|
|
URL_TEMPLATE = "/api/v1/external/raygun?&api_key={api_key}&stream={stream}"
|
|
FIXTURE_DIR_NAME = 'raygun'
|
|
|
|
def test_status_changed_message(self) -> None:
|
|
expected_topic = u"test"
|
|
expected_message = """
|
|
[Error](https://app.raygun.com/error-url) status changed to **Ignored** by Emma Cat:
|
|
* **Timestamp**: Wed Jan 28 01:49:36 1970
|
|
* **Application details**: [Best App](http://app.raygun.io/application-url)
|
|
""".strip()
|
|
|
|
self.send_and_test_stream_message('error_status_changed',
|
|
expected_topic,
|
|
expected_message,
|
|
content_type=
|
|
"application/x-www-form-urlencoded")
|
|
|
|
def test_comment_added_to_error_message(self) -> None:
|
|
expected_topic = u"test"
|
|
expected_message = """
|
|
Anita Peacock commented on [Error](https://app.raygun.com/error-url):
|
|
|
|
``` quote
|
|
Ignoring these errors
|
|
```
|
|
* **Timestamp**: Wed Jan 28 01:49:36 1970
|
|
* **Application details**: [application name](http://app.raygun.io/application-url)
|
|
""".strip()
|
|
|
|
self.send_and_test_stream_message('comment_added_to_error',
|
|
expected_topic,
|
|
expected_message,
|
|
content_type=
|
|
"application/x-www-form-urlencoded")
|
|
|
|
def test_error_assigned_to_user_message(self) -> None:
|
|
expected_topic = u"test"
|
|
expected_message = """
|
|
Amy Loondon assigned [Error](https://app.raygun.com/error-url) to Kyle Kenny:
|
|
* **Timestamp**: Wed Jan 28 01:49:36 1970
|
|
* **Application details**: [application name](http://app.raygun.io/application-url)
|
|
""".strip()
|
|
|
|
self.send_and_test_stream_message('error_assigned_to_user',
|
|
expected_topic,
|
|
expected_message,
|
|
content_type=
|
|
"application/x-www-form-urlencoded")
|
|
|
|
def test_one_minute_followup_error_message(self) -> None:
|
|
expected_topic = u"test"
|
|
expected_message = """
|
|
One minute [follow-up error](http://app.raygun.io/error-url):
|
|
* **First occurred**: Wed Jan 28 01:49:36 1970
|
|
* **Last occurred**: Wed Jan 28 01:49:36 1970
|
|
* 1 users affected with 1 total occurrences
|
|
* **Application details**: [application name](http://app.raygun.io/application-url)
|
|
""".strip()
|
|
|
|
self.send_and_test_stream_message('one_minute_followup_error',
|
|
expected_topic,
|
|
expected_message,
|
|
content_type=
|
|
"application/x-www-form-urlencoded")
|
|
|
|
def test_hourly_followup_error_message(self) -> None:
|
|
expected_topic = u"test"
|
|
expected_message = """
|
|
Hourly [follow-up error](http://app.raygun.io/error-url):
|
|
* **First occurred**: Wed Jan 28 01:49:36 1970
|
|
* **Last occurred**: Wed Jan 28 01:49:36 1970
|
|
* 1 users affected with 1 total occurrences
|
|
* **Application details**: [application name](http://app.raygun.io/application-url)
|
|
""".strip()
|
|
|
|
self.send_and_test_stream_message('hourly_followup_error',
|
|
expected_topic,
|
|
expected_message,
|
|
content_type=
|
|
"application/x-www-form-urlencoded")
|
|
|
|
def test_new_error_message(self) -> None:
|
|
expected_topic = u"test"
|
|
expected_message = """
|
|
New [Error](http://app.raygun.io/error-url) occurred:
|
|
* **First occurred**: Wed Jan 28 01:49:36 1970
|
|
* **Last occurred**: Wed Jan 28 01:49:36 1970
|
|
* 1 users affected with 1 total occurrences
|
|
* **Tags**: test, error-page, v1.0.1, env:staging
|
|
* **Affected user**: a9b7d8...33846
|
|
* **pageName**: Error Page
|
|
* **userLoggedIn**: True
|
|
* **Application details**: [application name](http://app.raygun.io/application-url)
|
|
""".strip()
|
|
|
|
self.send_and_test_stream_message('new_error',
|
|
expected_topic,
|
|
expected_message,
|
|
content_type=
|
|
"application/x-www-form-urlencoded")
|
|
|
|
def test_reoccurred_error_message(self) -> None:
|
|
expected_topic = u"test"
|
|
expected_message = """
|
|
[Error](http://app.raygun.io/error-url) reoccurred:
|
|
* **First occurred**: Wed Jan 28 01:49:36 1970
|
|
* **Last occurred**: Wed Jan 28 01:49:36 1970
|
|
* 1 users affected with 1 total occurrences
|
|
* **Tags**: test, error-page, v1.0.1, env:staging
|
|
* **Affected user**: a9b7d8...33846
|
|
* **pageName**: Error Page
|
|
* **userLoggedIn**: True
|
|
* **Application details**: [application name](http://app.raygun.io/application-url)
|
|
""".strip()
|
|
|
|
self.send_and_test_stream_message('reoccurred_error',
|
|
expected_topic,
|
|
expected_message,
|
|
content_type=
|
|
"application/x-www-form-urlencoded")
|
|
|
|
def get_body(self, fixture_name: str) -> str:
|
|
return self.webhook_fixture_data("raygun", fixture_name, file_type="json")
|