Files
upstream-zulip/zerver/webhooks/circleci/tests.py
upstream-mirror 64898b2c79
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
2026-09-15 15:05:30 +05:00

83 lines
4.9 KiB
Python

from zerver.lib.test_classes import WebhookTestCase
class CircleCiHookTests(WebhookTestCase):
def test_ping(self) -> None:
expected_topic_name = "Test event"
expected_message = "Webhook 'Testing' test event successful."
self.check_webhook("ping", expected_topic_name, expected_message)
def test_bitbucket_job_completed(self) -> None:
expected_topic_name = "circleci-webhook-testing"
expected_message = """
Job `build-and-test` within Pipeline #4 has succeeded.
Triggered on [`8ab595d2de9: app.py edited online with Bitbucket`](https://bitbucket.org/hariprashant1/circleci-webhook-testing/commits/8ab595d2de95767993472837df2cb7884519a92b) on branch `master` by Hari Prashant Bhimaraju.
""".strip()
self.check_webhook("bitbucket_job_completed", expected_topic_name, expected_message)
def test_bitbucket_manual_workflow_completed(self) -> None:
expected_topic_name = "circleci-webhook-testing"
expected_message = """
Workflow [`sample`](https://app.circleci.com/pipelines/bitbucket/hariprashant1/circleci-webhook-testing/2/workflows/baa45986-84db-47a0-bc6c-89e9fe751bc9) within Pipeline #2 has succeeded.
Triggered on `master`'s HEAD on [cab5eacb4cc](https://bitbucket.org/hariprashant1/circleci-webhook-testing/commits/cab5eacb4ccee2710529894425341fa20a48fe6a).
""".strip()
self.check_webhook(
"bitbucket_manual_workflow_completed", expected_topic_name, expected_message
)
def test_bitbucket_workflow_completed(self) -> None:
expected_topic_name = "circleci-webhook-testing"
expected_message = """
Workflow [`sample`](https://app.circleci.com/pipelines/bitbucket/hariprashant1/circleci-webhook-testing/4/workflows/fd29ef0c-3e39-4c8f-b1d5-d8be1bab8165) within Pipeline #4 has succeeded.
Triggered on [`8ab595d2de9: app.py edited online with Bitbucket`](https://bitbucket.org/hariprashant1/circleci-webhook-testing/commits/8ab595d2de95767993472837df2cb7884519a92b) on branch `master` by Hari Prashant Bhimaraju.
""".strip()
self.check_webhook("bitbucket_workflow_completed", expected_topic_name, expected_message)
def test_github_job_completed(self) -> None:
expected_topic_name = "main branch - build notifications"
expected_message = """
Job `build-and-test` within Pipeline #4 has succeeded.
Triggered on [`a5e30a90822: Fix remove-op on reaction event.`](https://github.com/zulip-testing/circleci-webhook-test/commit/a5e30a908224e46626a796d058289475f6d387b5) on branch `main` by Hari Prashant Bhimaraju.
""".strip()
self.check_webhook("github_job_completed", expected_topic_name, expected_message)
def test_github_tag_workflow_completed(self) -> None:
expected_topic_name = "circleci-webhook-test"
expected_message = """
Workflow [`sample`](https://app.circleci.com/pipelines/github/prah23/circleci-webhook-test/20/workflows/045c6271-78e2-4802-8a62-f4fa6d25d0c9) within Pipeline #20 has succeeded.
Triggered on the latest tag on [0e6e66c14e6](https://github.com/prah23/circleci-webhook-test/commit/0e6e66c14e61fbcd95db716b0f30d67dbcce7814).
""".strip()
self.check_webhook("github_tag_workflow_completed", expected_topic_name, expected_message)
def test_github_workflow_completed(self) -> None:
expected_topic_name = "circleci-webhook-test"
expected_message = """
Workflow [`sample`](https://app.circleci.com/pipelines/github/zulip-testing/circleci-webhook-test/4/workflows/7381218b-d04c-4aa3-b8b8-8c00a9319d1f) within Pipeline #4 has succeeded.
Triggered on [`a5e30a90822: .circleci: Update Webhook URL.`](https://github.com/zulip-testing/circleci-webhook-test/commit/a5e30a908224e46626a796d058289475f6d387b5) on branch `main` by Hari Prashant Bhimaraju.
""".strip()
self.check_webhook("github_workflow_completed", expected_topic_name, expected_message)
def test_gitlab_job_completed(self) -> None:
expected_topic_name = "circleci-webhook-test"
expected_message = """
Job `build-and-test` within Pipeline #3 has succeeded.
Triggered on [`c31f86994c5: app: Enhance message within hello().`](https://gitlab.com/zulip-testing/circleci-webhook-test/-/commit/c31f86994c54672f97b5bd5e544315b7bd40e4c1) on branch `main` by Hari Prashant Bhimaraju.
""".strip()
self.check_webhook("gitlab_job_completed", expected_topic_name, expected_message)
def test_gitlab_workflow_completed(self) -> None:
expected_topic_name = "circleci-webhook-test"
expected_message = """
Workflow [`sample`](https://app.circleci.com/pipelines/circleci/89xcrx7UvWQfzcUPAEmu5Q/63AY3yf3XeUQojmQcGZTtB/3/workflows/b23ceb64-127a-4075-a27c-d204a7a0a3b3) within Pipeline #3 has succeeded.
Triggered on [`c31f86994c5: app: Enhance message within hello().`](https://gitlab.com/zulip-testing/circleci-webhook-test/-/commit/c31f86994c54672f97b5bd5e544315b7bd40e4c1) on branch `main` by Hari Prashant Bhimaraju.
""".strip()
self.check_webhook("gitlab_workflow_completed", expected_topic_name, expected_message)