2018-01-06 16:48:01 +01:00
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
|
|
|
|
|
|
|
class RaygunHookTests(WebhookTestCase):
|
2024-05-04 22:02:50 +02:00
|
|
|
CHANNEL_NAME = "raygun"
|
2018-03-16 22:53:50 +01:00
|
|
|
URL_TEMPLATE = "/api/v1/external/raygun?&api_key={api_key}&stream={stream}"
|
2021-06-26 09:18:33 +02:00
|
|
|
WEBHOOK_DIR_NAME = "raygun"
|
2018-01-06 16:48:01 +01:00
|
|
|
|
|
|
|
def test_status_changed_message(self) -> None:
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "test"
|
2019-05-09 18:19:50 +02:00
|
|
|
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()
|
2018-01-06 16:48:01 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"error_status_changed",
|
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",
|
|
|
|
)
|
2018-01-06 16:48:01 +01:00
|
|
|
|
|
|
|
def test_comment_added_to_error_message(self) -> None:
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "test"
|
2019-05-09 18:19:50 +02:00
|
|
|
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()
|
2018-01-06 16:48:01 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"comment_added_to_error",
|
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",
|
|
|
|
)
|
2018-01-06 16:48:01 +01:00
|
|
|
|
|
|
|
def test_error_assigned_to_user_message(self) -> None:
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "test"
|
2019-05-09 18:19:50 +02:00
|
|
|
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()
|
2018-01-06 16:48:01 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"error_assigned_to_user",
|
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",
|
|
|
|
)
|
2018-01-06 16:48:01 +01:00
|
|
|
|
|
|
|
def test_one_minute_followup_error_message(self) -> None:
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "test"
|
2019-05-09 18:19:50 +02:00
|
|
|
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()
|
2018-01-06 16:48:01 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"one_minute_followup_error",
|
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",
|
|
|
|
)
|
2018-01-06 16:48:01 +01:00
|
|
|
|
|
|
|
def test_hourly_followup_error_message(self) -> None:
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "test"
|
2019-05-09 18:19:50 +02:00
|
|
|
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()
|
2018-01-06 16:48:01 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"hourly_followup_error",
|
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",
|
|
|
|
)
|
2018-01-06 16:48:01 +01:00
|
|
|
|
|
|
|
def test_new_error_message(self) -> None:
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "test"
|
2019-05-09 18:19:50 +02:00
|
|
|
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()
|
2018-01-06 16:48:01 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"new_error",
|
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",
|
|
|
|
)
|
2018-01-06 16:48:01 +01:00
|
|
|
|
|
|
|
def test_reoccurred_error_message(self) -> None:
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "test"
|
2019-05-09 18:19:50 +02:00
|
|
|
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()
|
2018-01-06 16:48:01 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"reoccurred_error",
|
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",
|
|
|
|
)
|