mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
realm/playground: Add API endpoint for creating playground entry.
This endpoint will allow clients to create a playground entry containing the name, pygments language and url_prefix for the playground of their choice. Introduced the `do_*` function in-charge of creating the entry in the model. Handling the process of sending events which will be done in a follow up commit. Added the openAPI format data to zulip.yaml for POST /realm/playgrounds. Also added python and curl examples for using the endpoint in its markdown documented (add-playground.md). Tests added.
This commit is contained in:
@@ -380,6 +380,22 @@ def remove_realm_filter(client: Client) -> None:
|
||||
validate_against_openapi_schema(result, "/realm/filters/{filter_id}", "delete", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/realm/playgrounds:post")
|
||||
def add_realm_playground(client: Client) -> None:
|
||||
|
||||
# {code_example|start}
|
||||
# Add a realm playground for Python
|
||||
request = {
|
||||
"name": "Python playground",
|
||||
"pygments_language": json.dumps("Python"),
|
||||
"url_prefix": json.dumps("https://python.example.com"),
|
||||
}
|
||||
result = client.call_endpoint(url="/realm/playgrounds", method="POST", request=request)
|
||||
# {code_example|end}
|
||||
|
||||
validate_against_openapi_schema(result, "/realm/playgrounds", "post", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/users/me:get")
|
||||
def get_profile(client: Client) -> None:
|
||||
|
||||
@@ -1417,6 +1433,7 @@ def test_server_organizations(client: Client) -> None:
|
||||
|
||||
get_realm_filters(client)
|
||||
add_realm_filter(client)
|
||||
add_realm_playground(client)
|
||||
get_server_settings(client)
|
||||
remove_realm_filter(client)
|
||||
get_realm_emoji(client)
|
||||
|
||||
Reference in New Issue
Block a user