Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
render_curl_example: Remove unused 'auth_email' & 'auth_api_key'.
Prakhar Pratyush9785cb4a099c
diff --git a/zerver/openapi/markdown_extension.py b/zerver/openapi/markdown_extension.pyindex 71b0d134a4e..c75693230a0 100644--- a/zerver/openapi/markdown_extension.py+++ b/zerver/openapi/markdown_extension.py@@ -268,8 +268,6 @@ def generate_curl_example(endpoint: str,method: str,api_url: str,- auth_email: str = DEFAULT_AUTH_EMAIL,- auth_api_key: str = DEFAULT_AUTH_API_KEY,exclude: list[str] | None = None,include: list[str] | None = None,) -> list[str]:@@ -321,6 +319,8 @@ def generate_curl_example()if authentication_required:+ auth_email = DEFAULT_AUTH_EMAIL+ auth_api_key = DEFAULT_AUTH_API_KEYlines.append(" -u " + shlex.quote(f"{auth_email}:{auth_api_key}"))for parameter in parameters:@@ -359,14 +359,8 @@ def render_curl_example(admin_config: bool = False,) -> list[str]:"""A simple wrapper around generate_curl_example."""- parts = function.split(":")- endpoint = parts[0]- method = parts[1]+ endpoint, method = function.split(":")kwargs: dict[str, Any] = {}- if len(parts) > 2:- kwargs["auth_email"] = parts[2]- if len(parts) > 3:- kwargs["auth_api_key"] = parts[3]kwargs["api_url"] = api_urlrendered_example = []for element in get_curl_include_exclude(endpoint, method):diff --git a/zerver/tests/test_openapi.py b/zerver/tests/test_openapi.pyindex bc3ffafc518..51a1ddcc17e 100644--- a/zerver/tests/test_openapi.py+++ b/zerver/tests/test_openapi.py@@ -853,12 +853,12 @@ class TestCurlExampleGeneration(ZulipTestCase):def test_generate_and_render_curl_wrapper(self) -> None:generated_curl_example = render_curl_example(- "/get_stream_id:GET:email:key", api_url="https://zulip.example.com/api"+ "/get_stream_id:GET", api_url="https://zulip.example.com/api")expected_curl_example = ["```curl","curl -sSX GET -G https://zulip.example.com/api/v1/get_stream_id \\",- " -u email:key \\",+ " -u BOT_EMAIL_ADDRESS:BOT_API_KEY \\"," --data-urlencode stream=Denmark","```",]