2016-12-31 18:06:29 +01:00
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
2020-01-14 22:06:24 +01:00
|
|
|
|
2016-12-31 18:06:29 +01:00
|
|
|
class SolanoHookTests(WebhookTestCase):
|
2024-05-04 22:02:50 +02:00
|
|
|
CHANNEL_NAME = "solano labs"
|
2020-04-09 21:51:58 +02:00
|
|
|
URL_TEMPLATE = "/api/v1/external/solano?api_key={api_key}&stream={stream}"
|
2021-06-26 09:18:33 +02:00
|
|
|
WEBHOOK_DIR_NAME = "solano"
|
2016-12-31 18:06:29 +01:00
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_solano_message_001(self) -> None:
|
2016-12-31 18:06:29 +01:00
|
|
|
"""
|
|
|
|
Build notifications are generated by Solano Labs after build completes.
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "build update"
|
2019-04-18 23:25:03 +02:00
|
|
|
expected_message = """
|
|
|
|
Build update (see [build log](https://ci.solanolabs.com:443/reports/3316175)):
|
|
|
|
* **Author**: solano-ci[bot]@users.noreply.github.com
|
2022-11-07 21:24:35 +01:00
|
|
|
* **Commit**: [5f438401eb7](github.com/fazerlicourice7/solano/commit/5f438401eb7cc7268cbc28438bfa70bb99f48a03)
|
2019-04-18 23:25:03 +02:00
|
|
|
* **Status**: failed :thumbs_down:
|
|
|
|
""".strip()
|
2016-12-31 18:06:29 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"build_001",
|
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",
|
|
|
|
)
|
2016-12-31 18:06:29 +01:00
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_solano_message_002(self) -> None:
|
2016-12-31 18:06:29 +01:00
|
|
|
"""
|
|
|
|
Build notifications are generated by Solano Labs after build completes.
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "build update"
|
2019-04-18 23:25:03 +02:00
|
|
|
expected_message = """
|
|
|
|
Build update (see [build log](https://ci.solanolabs.com:443/reports/3316723)):
|
|
|
|
* **Author**: Unknown
|
2022-11-07 21:24:35 +01:00
|
|
|
* **Commit**: [5d0b92e2644](bitbucket.org/fazerlicourice7/test/commits/5d0b92e26448a9e91db794bfed4b8c3556eabc4e)
|
2019-04-18 23:25:03 +02:00
|
|
|
* **Status**: failed :thumbs_down:
|
|
|
|
""".strip()
|
2016-12-31 18:06:29 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"build_002",
|
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",
|
|
|
|
)
|
2016-12-31 18:06:29 +01:00
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_solano_message_received(self) -> None:
|
2017-01-05 01:02:03 +01:00
|
|
|
"""
|
|
|
|
Build notifications are generated by Solano Labs after build completes.
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "build update"
|
2019-04-18 23:25:03 +02:00
|
|
|
expected_message = """
|
|
|
|
Build update (see [build log](https://ci.solanolabs.com:443/reports/3317799)):
|
|
|
|
* **Author**: solano-ci[bot]@users.noreply.github.com
|
2022-11-07 21:24:35 +01:00
|
|
|
* **Commit**: [191d34f9da8](github.com/anirudhjain75/scipy/commit/191d34f9da8ff7279b051cd68e44223253e18408)
|
2019-04-18 23:25:03 +02:00
|
|
|
* **Status**: running :arrows_counterclockwise:
|
|
|
|
""".strip()
|
2017-01-05 01:02:03 +01:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"received",
|
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",
|
|
|
|
)
|
2017-01-05 01:02:03 +01:00
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_solano_test_message(self) -> None:
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "build update"
|
2019-04-18 23:25:03 +02:00
|
|
|
expected_message = "Solano webhook set up correctly."
|
2017-04-11 08:58:23 +02:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook(
|
|
|
|
"test",
|
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",
|
|
|
|
)
|