Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

webhook docs: Avoid misleading `get_body` references.

Steve Howellef5de173fe28
diff --git a/templates/zerver/api/incoming-webhooks-walkthrough.md b/templates/zerver/api/incoming-webhooks-walkthrough.md
index 737f793dbc5..061269ad6d9 100644
--- a/templates/zerver/api/incoming-webhooks-walkthrough.md
+++ b/templates/zerver/api/incoming-webhooks-walkthrough.md
@@ -326,9 +326,6 @@ class HelloWorldHookTests(WebhookTestCase):
self.check_webhook('hello', expected_topic, expected_message,
content_type="application/x-www-form-urlencoded")
- def get_body(self, fixture_name: str) -> str:
- return self.webhook_fixture_data("helloworld", fixture_name, file_type="json")
-
```
In the above example, `STREAM_NAME`, `URL_TEMPLATE`, and `FIXTURE_DIR_NAME` refer
@@ -346,10 +343,6 @@ value from the fixture. If these don't match, the test will fail.
you would provide a webhook URL to the 3rd party service. `api_key={api_key}` says
that an API key is expected.
-In `get_body`, the first argument in the call to `self.webhook_fixture_data` specifies the
-prefix of your fixture file names, and `file_type` their type. Common types are
-`json` and `txt`.
-
When writing tests for your webhook, you'll want to include one test function
(and corresponding fixture) per each distinct message condition that your
integration supports.
@@ -591,14 +584,13 @@ class QuerytestHookTests(WebhookTestCase):
self.check_webhook('test_one', expected_topic, expected_message,
content_type="application/x-www-form-urlencoded")
-
- def get_body(self, fixture_name: str) -> str:
- return self.webhook_fixture_data("querytest", fixture_name, file_type="json")
```
-You can also override `get_body` if your test data needs to be constructed in
-an unusual way. For more, see the definition for the base class, `WebhookTestCase`
-in `zerver/lib/test_classes.py.`
+You can also override `get_body` or `get_payload` if your test data
+needs to be constructed in an unusual way.
+
+For more, see the definition for the base class, `WebhookTestCase`
+in `zerver/lib/test_classes.py`, or just grep for examples.
### Custom HTTP event-type headers