diff --git a/api_docs/include/rest-endpoints.md b/api_docs/include/rest-endpoints.md index 198e23a3fa..3e9c54307b 100644 --- a/api_docs/include/rest-endpoints.md +++ b/api_docs/include/rest-endpoints.md @@ -117,3 +117,4 @@ * [Fetch an API key (production)](/api/fetch-api-key) * [Fetch an API key (development only)](/api/dev-fetch-api-key) +* [Send a test notification to mobile device(s)](/api/test-notify) diff --git a/zerver/openapi/test_curl_examples.py b/zerver/openapi/test_curl_examples.py index b009afb198..136bffe9a5 100644 --- a/zerver/openapi/test_curl_examples.py +++ b/zerver/openapi/test_curl_examples.py @@ -24,6 +24,12 @@ from zerver.openapi.curl_param_value_generators import ( ) from zerver.openapi.openapi import get_endpoint_from_operationid +UNTESTED_GENERATED_CURL_EXAMPLES = { + # Would need push notification bouncer set up to test the + # generated curl example for this endpoint. + "test-notify", +} + def test_generated_curl_examples_for_success(client: Client) -> None: default_authentication_line = f"{client.email}:{client.api_key}" @@ -42,9 +48,10 @@ def test_generated_curl_examples_for_success(client: Client) -> None: with open(rest_endpoints_path) as f: rest_endpoints_raw = f.read() ENDPOINT_REGEXP = re.compile(r"/api/\s*(.*?)\)") - endpoint_list = sorted(set(re.findall(ENDPOINT_REGEXP, rest_endpoints_raw))) + documented_endpoints = set(re.findall(ENDPOINT_REGEXP, rest_endpoints_raw)) + endpoints_to_test = sorted(documented_endpoints.difference(UNTESTED_GENERATED_CURL_EXAMPLES)) - for endpoint in endpoint_list: + for endpoint in endpoints_to_test: article_name = endpoint + ".md" file_name = os.path.join(settings.DEPLOY_ROOT, "api_docs/", article_name)