mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
api/get-profile: Make code examples/fixtures testable.
This commit uses the Markdown extension defined in zerver/lib/bugdown/api_generate_examples to generate the example fixture and code example, so that both are tested in zerver/lib/api_test_helpers.
This commit is contained in:
@@ -60,10 +60,18 @@ def get_members(client):
|
||||
def get_profile(client):
|
||||
# type: (Client) -> None
|
||||
|
||||
# {code_example|start}
|
||||
# Get the profile of the user/bot that requests this endpoint,
|
||||
# which is `client` in this case:
|
||||
result = client.get_profile()
|
||||
assert result['is_admin']
|
||||
assert result['email'] == 'iago@zulip.com'
|
||||
assert result['full_name'] == 'Iago'
|
||||
# {code_example|end}
|
||||
|
||||
fixture = FIXTURES['get-profile']
|
||||
check_if_equal = ['email', 'full_name', 'msg', 'result', 'short_name']
|
||||
check_if_exists = ['client_id', 'is_admin', 'is_bot', 'max_message_id',
|
||||
'pointer', 'user_id']
|
||||
test_against_fixture(result, fixture, check_if_equal=check_if_equal,
|
||||
check_if_exists=check_if_exists)
|
||||
|
||||
def get_stream_id(client):
|
||||
# type: (Client) -> None
|
||||
@@ -245,6 +253,7 @@ TEST_FUNCTIONS = {
|
||||
'get-subscribed-streams': list_subscriptions,
|
||||
'get-all-streams': get_streams,
|
||||
'create-user': create_user,
|
||||
'get-profile': get_profile,
|
||||
}
|
||||
|
||||
# SETUP METHODS FOLLOW
|
||||
|
||||
Reference in New Issue
Block a user