mirror of https://github.com/zulip/zulip.git
webhooks: Add test event handler to Dropbox Sign.
This commit is contained in:
parent
f831a4c635
commit
8bc599abd1
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"event": {
|
||||
"event_time": "1729521679",
|
||||
"event_type": "callback_test",
|
||||
"event_hash": "1abb1c65915585ab5afgec6f62c479b2917a889605f7ee867f64cbb313666f8f",
|
||||
"event_metadata": {
|
||||
"reported_for_account_id": "7ca5011f9071abc48c498f10a5692ea36f9534e3"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,6 +55,13 @@ class DropboxSignHookTests(WebhookTestCase):
|
|||
topic=expected_topic_name,
|
||||
)
|
||||
|
||||
def test_callback_test(self) -> None:
|
||||
expected_topic_name = "Dropbox Sign"
|
||||
expected_message = "Dropbox Sign webhook has been successfully configured."
|
||||
self.check_webhook(
|
||||
"callback_test", expected_topic_name, expected_message, content_type=None
|
||||
)
|
||||
|
||||
@override
|
||||
def get_payload(self, fixture_name: str) -> dict[str, str]:
|
||||
return {"json": self.webhook_fixture_data("dropboxsign", fixture_name, file_type="json")}
|
||||
|
|
|
@ -7,7 +7,7 @@ from zerver.decorator import webhook_view
|
|||
from zerver.lib.response import json_success
|
||||
from zerver.lib.typed_endpoint import ApiParamConfig, typed_endpoint
|
||||
from zerver.lib.validator import WildValue, check_string
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, get_setup_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
IS_AWAITING_SIGNATURE = "is awaiting the signature of {awaiting_recipients}"
|
||||
|
@ -68,5 +68,9 @@ def api_dropboxsign_webhook(
|
|||
body = get_message_body(payload)
|
||||
topic_name = payload["signature_request"]["title"].tame(check_string)
|
||||
check_send_webhook_message(request, user_profile, topic_name, body)
|
||||
elif payload["event"]["event_type"] == "callback_test":
|
||||
body = get_setup_webhook_message("Dropbox Sign")
|
||||
topic_name = "Dropbox Sign"
|
||||
check_send_webhook_message(request, user_profile, topic_name, body)
|
||||
|
||||
return json_success(request, data={"msg": "Hello API Event Received"})
|
||||
|
|
Loading…
Reference in New Issue