mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
api docs: Add documentation of deactivate-own-user endpoint.
Currently, there was no markdown page for deactivate-own-user API endpoint. Created deactivate-own-user.md for the API page and created a new owner client in test-api to reactivate the client deactivated during testing. Also changed endpoint name from deactivate-my-account to deactivate-own-user, for better consistency with other endpoints. Fixes #16163.
This commit is contained in:
committed by
Tim Abbott
parent
82d6d925e5
commit
d3a3c6898c
@@ -392,6 +392,23 @@ def get_profile(client: Client) -> None:
|
||||
validate_against_openapi_schema(result, "/users/me", "get", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/users/me:delete")
|
||||
def deactivate_own_user(client: Client, owner_client: Client) -> None:
|
||||
user_id = client.get_profile()["user_id"]
|
||||
|
||||
# {code_example|start}
|
||||
# Deactivate the account of the current user/bot that requests.
|
||||
result = client.call_endpoint(
|
||||
url="/users/me",
|
||||
method="DELETE",
|
||||
)
|
||||
# {code_example|end}
|
||||
|
||||
# Reactivate the account to avoid polluting other tests.
|
||||
owner_client.reactivate_user_by_id(user_id)
|
||||
validate_against_openapi_schema(result, "/users/me", "delete", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/get_stream_id:get")
|
||||
def get_stream_id(client: Client) -> int:
|
||||
|
||||
@@ -1295,7 +1312,7 @@ def test_messages(client: Client, nonadmin_client: Client) -> None:
|
||||
test_delete_message_edit_permission_error(client, nonadmin_client)
|
||||
|
||||
|
||||
def test_users(client: Client) -> None:
|
||||
def test_users(client: Client, owner_client: Client) -> None:
|
||||
|
||||
create_user(client)
|
||||
get_members(client)
|
||||
@@ -1320,6 +1337,7 @@ def test_users(client: Client) -> None:
|
||||
get_alert_words(client)
|
||||
add_alert_words(client)
|
||||
remove_alert_words(client)
|
||||
deactivate_own_user(client, owner_client)
|
||||
|
||||
|
||||
def test_streams(client: Client, nonadmin_client: Client) -> None:
|
||||
@@ -1371,10 +1389,10 @@ def test_errors(client: Client) -> None:
|
||||
test_invalid_stream_error(client)
|
||||
|
||||
|
||||
def test_the_api(client: Client, nonadmin_client: Client) -> None:
|
||||
def test_the_api(client: Client, nonadmin_client: Client, owner_client: Client) -> None:
|
||||
|
||||
get_user_agent(client)
|
||||
test_users(client)
|
||||
test_users(client, owner_client)
|
||||
test_streams(client, nonadmin_client)
|
||||
test_messages(client, nonadmin_client)
|
||||
test_queues(client)
|
||||
|
||||
Reference in New Issue
Block a user