Files
zulip/zerver/webhooks/codeship/tests.py
Prakhar Pratyush 3afc8ed7ae webhooks: Rename *topic local variables to *topic_name.
This is preparatory work towards adding a Topic model.
We plan to use the local variable name as 'topic' for
the Topic model objects.

Currently, we use *topic as the local variable name for
topic names.

We rename local variables of the form *topic to *topic_name
so that we don't need to think about type collisions in
individual code paths where we might want to talk about both
Topic objects and strings for the topic name.
2024-01-17 08:35:29 -08:00

37 lines
1.8 KiB
Python

from zerver.lib.test_classes import WebhookTestCase
class CodeshipHookTests(WebhookTestCase):
STREAM_NAME = "codeship"
URL_TEMPLATE = "/api/v1/external/codeship?stream={stream}&api_key={api_key}"
TOPIC_NAME = "codeship/docs"
WEBHOOK_DIR_NAME = "codeship"
def test_codeship_build_in_testing_status_message(self) -> None:
"""
Tests if codeship testing status is mapped correctly
"""
expected_message = "[Build](https://www.codeship.com/projects/10213/builds/973711) triggered by beanieboi on master branch started."
self.check_webhook("testing_build", self.TOPIC_NAME, expected_message)
def test_codeship_build_in_error_status_message(self) -> None:
"""
Tests if codeship error status is mapped correctly
"""
expected_message = "[Build](https://www.codeship.com/projects/10213/builds/973711) triggered by beanieboi on master branch failed."
self.check_webhook("error_build", self.TOPIC_NAME, expected_message)
def test_codeship_build_in_success_status_message(self) -> None:
"""
Tests if codeship success status is mapped correctly
"""
expected_message = "[Build](https://www.codeship.com/projects/10213/builds/973711) triggered by beanieboi on master branch succeeded."
self.check_webhook("success_build", self.TOPIC_NAME, expected_message)
def test_codeship_build_in_other_status_status_message(self) -> None:
"""
Tests if codeship other status is mapped correctly
"""
expected_message = "[Build](https://www.codeship.com/projects/10213/builds/973711) triggered by beanieboi on master branch has some_other_status status."
self.check_webhook("other_status_build", self.TOPIC_NAME, expected_message)