Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webhooks/dbt: Rename "DBT" to "dbt".
Niloth Pac97afa40820
diff --git a/static/images/integrations/dbt/001.png b/static/images/integrations/dbt/001.pngindex e3700a2824f..60aa5671860 100644Binary files a/static/images/integrations/dbt/001.png and b/static/images/integrations/dbt/001.png differdiff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.pyindex 61d79c3607d..ced116b5503 100644--- a/zerver/lib/integrations.py+++ b/zerver/lib/integrations.py@@ -599,9 +599,9 @@ INCOMING_WEBHOOK_INTEGRATIONS: list[IncomingWebhookIntegration] = ["dbt",["deployment"],[WebhookScreenshotConfig("job_run_completed_errored.json")],- display_name="DBT",+ display_name="dbt",url_options=[- WebhookUrlOption(name="access_url", label="DBT Access URL", input_type="text")+ WebhookUrlOption(name="access_url", label="dbt Access URL", input_type="text")],),IncomingWebhookIntegration(diff --git a/zerver/webhooks/dbt/doc.md b/zerver/webhooks/dbt/doc.mdindex 42dd9ae3144..776e9fedb55 100644--- a/zerver/webhooks/dbt/doc.md+++ b/zerver/webhooks/dbt/doc.md@@ -1,6 +1,6 @@-# Zulip DBT integration+# Zulip dbt integration-Get notifications about DBT cloud job runs in Zulip!+Get notifications about dbt cloud job runs in Zulip!{start_tabs}@@ -8,11 +8,11 @@ Get notifications about DBT cloud job runs in Zulip!1. {!generate-webhook-url-basic.md!}- If you'd like your notification messages to link to your DBT job- runs, make sure you include the [**DBT Access URL**][DBT Access URLs]+ If you'd like your notification messages to link to your dbt job+ runs, make sure you include the [**dbt Access URL**][dbt Access URLs]when generating the integration URL.-1. From your DBT Dashboard, navigate to **Account settings**. Select+1. From your dbt Dashboard, navigate to **Account settings**. Select**Notification Settings**, go to the **Webhooks** section, andclick **Create webhook**.@@ -33,8 +33,8 @@ Get notifications about DBT cloud job runs in Zulip!### Related documentation-- [DBT's webhooks documentation](https://docs.getdbt.com/docs/deploy/webhooks)-- [DBT Access URLs][DBT Access URLs]+- [dbt's webhooks documentation](https://docs.getdbt.com/docs/deploy/webhooks)+- [dbt Access URLs][dbt Access URLs]{!webhooks-url-specification.md!}-[DBT Access URLs]: https://docs.getdbt.com/docs/cloud/about-cloud/access-regions-ip-addresses#api-access-urls+[dbt Access URLs]: https://docs.getdbt.com/docs/cloud/about-cloud/access-regions-ip-addresses#api-access-urlsdiff --git a/zerver/webhooks/dbt/tests.py b/zerver/webhooks/dbt/tests.pyindex 6bdce7ec6b9..673b3c59224 100644--- a/zerver/webhooks/dbt/tests.py+++ b/zerver/webhooks/dbt/tests.py@@ -1,7 +1,7 @@from zerver.lib.test_classes import WebhookTestCase-class DBTHookTests(WebhookTestCase):+class DbtHookTests(WebhookTestCase):def test_dbt_webhook_when_job_started(self) -> None:expected_message = """:yellow_circle: Daily Job (dbt build) deployment started in **Production**.\nJob #123 was kicked off from the UI by [email protected] at <time:2023-01-31T19:28:07Z>."""@@ -23,7 +23,7 @@ Job #123 was kicked off from the UI by [email protected] at <time:2023-01-31self.check_webhook("job_run_errored", "Example Project", expected_message)-class DBTHookWithAccessUrlTests(WebhookTestCase):+class DbtHookWithAccessUrlTests(WebhookTestCase):URL_TEMPLATE = "/api/v1/external/dbt?&api_key={api_key}&stream={stream}&access_url=https%3A%2F%2Fexample.us1.dbt.com"def test_dbt_webhook_with_valid_access_url(self) -> None:diff --git a/zerver/webhooks/dbt/view.py b/zerver/webhooks/dbt/view.pyindex 9d146abd5cc..04e5f176043 100644--- a/zerver/webhooks/dbt/view.py+++ b/zerver/webhooks/dbt/view.py@@ -9,13 +9,13 @@ from zerver.lib.validator import WildValue, check_int, check_stringfrom zerver.lib.webhooks.common import check_send_webhook_messagefrom zerver.models import UserProfile-DBT_NOTIFICATION_TEMPLATE = """+NOTIFICATION_TEMPLATE = """{emoji} {job_name} {run_text} {status} in **{environment}**.{job_text} was {run_reason} at <time:{start_time}>."""-DBT_EVENT_TYPE_MAPPER = {+EVENT_TYPE_MAPPER = {"job.run.started": {"running": (":yellow_circle:", "started"),},@@ -28,7 +28,7 @@ DBT_EVENT_TYPE_MAPPER = {},}-ALL_EVENT_TYPES = list(DBT_EVENT_TYPE_MAPPER.keys())+ALL_EVENT_TYPES = list(EVENT_TYPE_MAPPER.keys())def extract_data_from_payload(payload: JsonBodyPayload[WildValue]) -> dict[str, str]:@@ -52,7 +52,7 @@ def extract_data_from_payload(payload: JsonBodyPayload[WildValue]) -> dict[str,def get_job_run_body(data: dict[str, str], access_url: str | None) -> str:- emoji, status = DBT_EVENT_TYPE_MAPPER[data["event_type"]][data["run_status"]]+ emoji, status = EVENT_TYPE_MAPPER[data["event_type"]][data["run_status"]]project_url = (urljoin(@@ -69,7 +69,7 @@ def get_job_run_body(data: dict[str, str], access_url: str | None) -> str:)run_text = f"[deployment]({project_url}/runs/{data['run_id']})" if project_url else "deployment"- body = DBT_NOTIFICATION_TEMPLATE.format(+ body = NOTIFICATION_TEMPLATE.format(emoji=emoji,status=status,run_text=run_text,