api: Add GET /users/{user_id}/subscription/{stream_id} endpoint.

This new endpoint returns a 'user' dictionary which, as of now,
contains a single key 'is_subscribed' with a boolean value that
represents whether the user with the given 'user_id' is subscribed
to the stream with the given 'stream_id'.

Fixes #14966.
This commit is contained in:
Kartik Srivastava
2020-05-31 22:40:41 +05:30
committed by Tim Abbott
parent d5cc29755e
commit 8c39ddfd28
9 changed files with 130 additions and 2 deletions

View File

@@ -253,6 +253,19 @@ def update_user(client: Client) -> None:
# {code_example|end}
validate_against_openapi_schema(result, '/users/{user_id}', 'patch', '400')
@openapi_test_function("/users/{user_id}/subscriptions/{stream_id}:get")
def get_subscription_status(client: Client) -> None:
# {code_example|start}
# Check whether a user is a subscriber to a given stream.
user_id = 7
stream_id = 1
result = client.call_endpoint(
url='/users/{}/subscriptions/{}'.format(user_id, stream_id),
method='GET',
)
# {code_example|end}
validate_against_openapi_schema(result, '/users/{user_id}/subscriptions/{stream_id}', 'get', '200')
@openapi_test_function("/realm/filters:get")
def get_realm_filters(client: Client) -> None:
@@ -1117,6 +1130,7 @@ def test_users(client: Client) -> None:
deactivate_user(client)
reactivate_user(client)
update_user(client)
get_subscription_status(client)
get_profile(client)
update_notification_settings(client)
upload_file(client)