api: Add GET /user_groups documentation.

This documents our GET endpoint for interacting with Zulip's user
groups feature.

Fixes #10298.
This commit is contained in:
Roman Godov
2018-08-19 00:06:53 +03:00
committed by Tim Abbott
parent 8c8cb725bf
commit aa3682f9fc
4 changed files with 109 additions and 0 deletions

View File

@@ -234,6 +234,18 @@ def get_streams(client):
validate_against_openapi_schema(result, '/streams', 'get', '200')
assert len(result['streams']) == 4
def get_user_groups(client):
# type: (Client) -> None
# {code_example|start}
# Get all user groups of the realm
result = client.get_user_groups()
# {code_example|end}
validate_against_openapi_schema(result, '/user_groups', 'get', '200')
user_groups = [u for u in result['user_groups'] if u['name'] == "hamletcharacters"]
assert user_groups[0]['description'] == 'Characters of Hamlet'
def test_user_not_authorized_error(nonadmin_client):
# type: (Client) -> None
result = nonadmin_client.get_streams(include_all_active=True)
@@ -793,6 +805,7 @@ TEST_FUNCTIONS = {
'/user_uploads:post': upload_file,
'/users/me/{stream_id}/topics:get': get_stream_topics,
'/typing:post': set_typing_status,
'/user_groups:get': get_user_groups,
}
# SETUP METHODS FOLLOW
@@ -871,6 +884,7 @@ def test_users(client):
upload_file(client)
set_typing_status(client)
get_user_presence(client)
get_user_groups(client)
def test_streams(client, nonadmin_client):
# type: (Client, Client) -> None