api: Add REST API endpoint for looking up a user by email address.

Add new rest api endpoint GET users/{email} for looking up a user by
email, which is useful especially for corporate API applications that
might already have a user's email address.

Fixes #14302.
This commit is contained in:
Tushar912
2021-01-02 19:35:29 +05:30
committed by Tim Abbott
parent 1212083218
commit dfafdda9b3
11 changed files with 205 additions and 5 deletions

View File

@@ -222,6 +222,20 @@ def get_members(client: Client) -> None:
assert member.get("profile_data", None) is not None
@openapi_test_function("/users/{email}:get")
def get_user_by_email(client: Client) -> None:
# {code_example|start}
# Fetch details on a user given a user ID
email = "iago@zulip.com"
result = client.call_endpoint(
url=f"/users/{email}",
method="GET",
)
# {code_example|end}
validate_against_openapi_schema(result, "/users/{email}", "get", "200")
@openapi_test_function("/users/{user_id}:get")
def get_single_user(client: Client) -> None:
@@ -1287,6 +1301,7 @@ def test_users(client: Client) -> None:
deactivate_user(client)
reactivate_user(client)
update_user(client)
get_user_by_email(client)
get_subscription_status(client)
get_profile(client)
update_notification_settings(client)