from zerver.lib.test_classes import WebhookTestCase class GocdHookTests(WebhookTestCase): def test_building_pipeline(self) -> None: expected_topic = "Pipeline / Stage" expected_message = """**Pipeline building**: Pipeline / Stage - **Commit**: [`59f3c6e4540`](https://github.com/swayam0322/Test/commit/59f3c6e4540) on branch `main` - **Started**: """ self.check_webhook( "pipeline_building", expected_topic, expected_message, ) def test_completed_pipeline_success(self) -> None: expected_topic = "Pipeline / Stage" expected_message = """:green_circle: **Build passed**: Pipeline / Stage - **Commit**: [`59f3c6e4540`](https://github.com/swayam0322/Test/commit/59f3c6e4540) on branch `main` - **Started**: - **Finished**: - **Passed**: `Job`""" self.check_webhook("pipeline_passed", expected_topic, expected_message) def test_completed_pipeline_fail(self) -> None: expected_topic = "pipeline-one / stage-two" expected_message = """:red_circle: **Build failed**: pipeline-one / stage-two - **Commit**: [`963eb239c7b`](https://github.com/PieterCK/getting-started-repo.git/commit/963eb239c7b) on branch `master` - **Started**: - **Finished**: - **Failed**: `task-two`""" self.check_webhook("pipeline_failed", expected_topic, expected_message) def test_completed_pipeline_with_mixed_result(self) -> None: expected_topic = "test-pipeline / backend-tests" expected_message = """:red_circle: **Build failed**: test-pipeline / backend-tests - **Commit**: [`963eb239c7b`](https://github.com/PieterCK/getting-started-repo.git/commit/963eb239c7b) on branch `master` - **Started**: - **Finished**: - **Failed**: `check-backend-lints`, `test-frontend-js` - **Passed**: `check-backend-tests`, `zulip-ci-debian-12`""" self.check_webhook("pipeline_with_mixed_job_result", expected_topic, expected_message)