2018-09-10 19:03:23 +02:00
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
2020-01-14 22:06:24 +01:00
|
|
|
|
2018-09-10 19:03:23 +02:00
|
|
|
class AppveyorHookTests(WebhookTestCase):
|
2021-02-12 08:20:45 +01:00
|
|
|
STREAM_NAME = "appveyor"
|
2018-09-10 19:03:23 +02:00
|
|
|
URL_TEMPLATE = "/api/v1/external/appveyor?api_key={api_key}&stream={stream}"
|
2021-06-26 09:18:33 +02:00
|
|
|
WEBHOOK_DIR_NAME = "appveyor"
|
2018-09-10 19:03:23 +02:00
|
|
|
|
|
|
|
def test_appveyor_build_success_message(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if appveyor build success notification is handled correctly
|
|
|
|
"""
|
2018-11-09 20:33:58 +01:00
|
|
|
expected_topic = "Hubot-DSC-Resource"
|
2019-04-10 06:07:51 +02:00
|
|
|
expected_message = """
|
|
|
|
[Build Hubot-DSC-Resource 2.0.59 completed](https://ci.appveyor.com/project/joebloggs/hubot-dsc-resource/build/2.0.59):
|
|
|
|
* **Commit**: [c06e208b47: Increment version number.](https://github.com/joebloggs/Hubot-DSC-Resource/commit/c06e208b47) by Joe Bloggs
|
|
|
|
* **Started**: 9/9/2018 7:04 PM
|
|
|
|
* **Finished**: 9/9/2018 7:06 PM
|
|
|
|
""".strip()
|
2018-09-10 19:03:23 +02:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook("appveyor_build_success", expected_topic, expected_message)
|
2018-09-10 19:03:23 +02:00
|
|
|
|
|
|
|
def test_appveyor_build_failure_message(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if appveyor build failure notification is handled correctly
|
|
|
|
"""
|
2018-11-09 20:33:58 +01:00
|
|
|
expected_topic = "Hubot-DSC-Resource"
|
2019-04-10 06:07:51 +02:00
|
|
|
expected_message = """
|
|
|
|
[Build Hubot-DSC-Resource 2.0.59 failed](https://ci.appveyor.com/project/joebloggs/hubot-dsc-resource/build/2.0.59):
|
|
|
|
* **Commit**: [c06e208b47: Increment version number.](https://github.com/joebloggs/Hubot-DSC-Resource/commit/c06e208b47) by Joe Bloggs
|
|
|
|
* **Started**: 9/9/2018 7:04 PM
|
|
|
|
* **Finished**: 9/9/2018 7:06 PM
|
|
|
|
""".strip()
|
2018-09-10 19:03:23 +02:00
|
|
|
|
2020-08-23 15:49:24 +02:00
|
|
|
self.check_webhook("appveyor_build_failure", expected_topic, expected_message)
|