本文整理汇总了Python中zerver.lib.openapi.validate_against_openapi_schema函数的典型用法代码示例。如果您正苦于以下问题:Python validate_against_openapi_schema函数的具体用法?Python validate_against_openapi_schema怎么用?Python validate_against_openapi_schema使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validate_against_openapi_schema函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: remove_subscriptions
def remove_subscriptions(client):
# type: (Client) -> None
# {code_example|start}
# Unsubscribe from the stream "new stream"
result = client.remove_subscriptions(
['new stream']
)
# {code_example|end}
validate_against_openapi_schema(result, '/users/me/subscriptions',
'delete', '200')
# test it was actually removed
result = client.list_subscriptions()
assert result['result'] == 'success'
streams = [s for s in result['subscriptions'] if s['name'] == 'new stream']
assert len(streams) == 0
# {code_example|start}
# Unsubscribe another user from the stream "new stream"
result = client.remove_subscriptions(
['new stream'],
principals=['[email protected]']
)
# {code_example|end}
validate_against_openapi_schema(result, '/users/me/subscriptions',
'delete', '200')
开发者ID:gregmccoy,项目名称:zulip,代码行数:29,代码来源:api_test_helpers.py
示例2: add_subscriptions
def add_subscriptions(client):
# type: (Client) -> None
# {code_example|start}
# Subscribe to the stream "new stream"
result = client.add_subscriptions(
streams=[
{
'name': 'new stream',
'description': 'New stream for testing'
}
]
)
# {code_example|end}
validate_against_openapi_schema(result, '/users/me/subscriptions', 'post',
'200_without_principals')
# {code_example|start}
# To subscribe another user to a stream, you may pass in
# the `principals` argument, like so:
result = client.add_subscriptions(
streams=[
{'name': 'new stream', 'description': 'New stream for testing'}
],
principals=['[email protected]']
)
# {code_example|end}
assert result['result'] == 'success'
assert '[email protected]' in result['subscribed']
开发者ID:gregmccoy,项目名称:zulip,代码行数:30,代码来源:api_test_helpers.py
示例3: update_message
def update_message(client, message_id):
# type: (Client, int) -> None
assert int(message_id)
# {code_example|start}
# Edit a message
# (make sure that message_id below is set to the ID of the
# message you wish to update)
request = {
"message_id": message_id,
"content": "New content"
}
result = client.update_message(request)
# {code_example|end}
validate_against_openapi_schema(result, '/messages/{message_id}', 'patch',
'200')
# test it was actually updated
url = 'messages/' + str(message_id)
result = client.call_endpoint(
url=url,
method='GET'
)
assert result['result'] == 'success'
assert result['raw_content'] == request['content']
开发者ID:gregmccoy,项目名称:zulip,代码行数:27,代码来源:api_test_helpers.py
示例4: test_authorization_errors_fatal
def test_authorization_errors_fatal(client, nonadmin_client):
# type: (Client, Client) -> None
client.add_subscriptions(
streams=[
{'name': 'private_stream'}
],
)
stream_id = client.get_stream_id('private_stream')['stream_id']
client.call_endpoint(
'streams/{}'.format(stream_id),
method='PATCH',
request={'is_private': True}
)
result = nonadmin_client.add_subscriptions(
streams=[
{'name': 'private_stream'}
],
authorization_errors_fatal=False,
)
validate_against_openapi_schema(result, '/users/me/subscriptions', 'post',
'400_unauthorized_errors_fatal_false')
result = nonadmin_client.add_subscriptions(
streams=[
{'name': 'private_stream'}
],
authorization_errors_fatal=True,
)
validate_against_openapi_schema(result, '/users/me/subscriptions', 'post',
'400_unauthorized_errors_fatal_true')
开发者ID:gregmccoy,项目名称:zulip,代码行数:34,代码来源:api_test_helpers.py
示例5: get_realm_emoji
def get_realm_emoji(client):
# type: (Client) -> None
# {code_example|start}
result = client.get_realm_emoji()
# {code_example|end}
validate_against_openapi_schema(result, '/realm/emoji', 'GET', '200')
开发者ID:rishig,项目名称:zulip,代码行数:8,代码来源:api_test_helpers.py
示例6: mark_stream_as_read
def mark_stream_as_read(client):
# type: (Client) -> None
# {code_example|start}
# Mark the unread messages in stream with ID "1" as read
result = client.mark_stream_as_read(1)
# {code_example|end}
validate_against_openapi_schema(result, '/mark_stream_as_read', 'post', '200')
开发者ID:rishig,项目名称:zulip,代码行数:9,代码来源:api_test_helpers.py
示例7: mark_all_as_read
def mark_all_as_read(client):
# type: (Client) -> None
# {code_example|start}
# Mark all of the user's unread messages as read
result = client.mark_all_as_read()
# {code_example|end}
validate_against_openapi_schema(result, '/mark_all_as_read', 'post', '200')
开发者ID:rishig,项目名称:zulip,代码行数:9,代码来源:api_test_helpers.py
示例8: get_realm_filters
def get_realm_filters(client):
# type: (Client) -> None
# {code_example|start}
# Fetch all the filters in this organization
result = client.get_realm_filters()
# {code_example|end}
validate_against_openapi_schema(result, '/realm/filters', 'get', '200')
开发者ID:rishig,项目名称:zulip,代码行数:9,代码来源:api_test_helpers.py
示例9: get_stream_topics
def get_stream_topics(client, stream_id):
# type: (Client, int) -> None
# {code_example|start}
result = client.get_stream_topics(stream_id)
# {code_example|end}
validate_against_openapi_schema(result, '/users/me/{stream_id}/topics',
'get', '200')
开发者ID:gregmccoy,项目名称:zulip,代码行数:9,代码来源:api_test_helpers.py
示例10: get_server_settings
def get_server_settings(client):
# type: (Client) -> None
# {code_example|start}
# Fetch the settings for this server
result = client.get_server_settings()
# {code_example|end}
validate_against_openapi_schema(result, '/server_settings', 'get', '200')
开发者ID:gregmccoy,项目名称:zulip,代码行数:9,代码来源:api_test_helpers.py
示例11: remove_realm_filter
def remove_realm_filter(client):
# type: (Client) -> None
# {code_example|start}
# Remove the organization filter with ID 42
result = client.remove_realm_filter(42)
# {code_example|end}
validate_against_openapi_schema(result, '/realm/filters/<filter_id>', 'delete', '200')
开发者ID:rishig,项目名称:zulip,代码行数:9,代码来源:api_test_helpers.py
示例12: get_user_presence
def get_user_presence(client):
# type: (Client) -> None
# {code_example|start}
# Get presence information for "[email protected]"
result = client.get_user_presence('[email protected]')
# {code_example|end}
validate_against_openapi_schema(result, '/users/{email}/presence', 'get', '200')
开发者ID:gregmccoy,项目名称:zulip,代码行数:9,代码来源:api_test_helpers.py
示例13: delete_message
def delete_message(client, message_id):
# type: (Client, int) -> None
# {code_example|start}
# Delete the message with ID "message_id"
result = client.delete_message(message_id)
# {code_example|end}
validate_against_openapi_schema(result, '/messages/{message_id}', 'delete',
'200')
开发者ID:gregmccoy,项目名称:zulip,代码行数:10,代码来源:api_test_helpers.py
示例14: get_stream_id
def get_stream_id(client):
# type: (Client) -> None
# {code_example|start}
# Get the ID of a given stream
stream_name = 'new stream'
result = client.get_stream_id(stream_name)
# {code_example|end}
validate_against_openapi_schema(result, '/get_stream_id', 'get', '200')
开发者ID:gregmccoy,项目名称:zulip,代码行数:10,代码来源:api_test_helpers.py
示例15: get_message_history
def get_message_history(client, message_id):
# type: (Client, int) -> None
# {code_example|start}
# Get the edit history for message with ID "message_id"
result = client.get_message_history(message_id)
# {code_example|end}
validate_against_openapi_schema(result, '/messages/{message_id}/history',
'get', '200')
开发者ID:gregmccoy,项目名称:zulip,代码行数:10,代码来源:api_test_helpers.py
示例16: get_user_groups
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'
开发者ID:rishig,项目名称:zulip,代码行数:11,代码来源:api_test_helpers.py
示例17: test_private_message_invalid_recipient
def test_private_message_invalid_recipient(client):
# type: (Client) -> None
request = {
"type": "private",
"to": "[email protected]",
"content": "With mirth and laughter let old wrinkles come."
}
result = client.send_message(request)
validate_against_openapi_schema(result, '/messages', 'post',
'400_non_existing_user')
开发者ID:rishig,项目名称:zulip,代码行数:11,代码来源:api_test_helpers.py
示例18: test_add_subscriptions_already_subscribed
def test_add_subscriptions_already_subscribed(client):
# type: (Client) -> None
result = client.add_subscriptions(
streams=[
{'name': 'new stream', 'description': 'New stream for testing'}
],
principals=['[email protected]']
)
validate_against_openapi_schema(result, '/users/me/subscriptions', 'post',
'200_already_subscribed')
开发者ID:gregmccoy,项目名称:zulip,代码行数:11,代码来源:api_test_helpers.py
示例19: add_realm_filter
def add_realm_filter(client):
# type: (Client) -> None
# {code_example|start}
# Add a filter to automatically linkify #<number> to the corresponding
# issue in Zulip's server repo
result = client.add_realm_filter('#(?P<id>[0-9]+)',
'https://github.com/zulip/zulip/issues/%(id)s')
# {code_example|end}
validate_against_openapi_schema(result, '/realm/filters', 'post', '200')
开发者ID:gregmccoy,项目名称:zulip,代码行数:11,代码来源:api_test_helpers.py
示例20: test_nonexistent_stream_error
def test_nonexistent_stream_error(client):
# type: (Client) -> None
request = {
"type": "stream",
"to": "nonexistent_stream",
"subject": "Castle",
"content": "Something is rotten in the state of Denmark."
}
result = client.send_message(request)
validate_against_openapi_schema(result, '/messages', 'post',
'400_non_existing_stream')
开发者ID:gregmccoy,项目名称:zulip,代码行数:12,代码来源:api_test_helpers.py
注:本文中的zerver.lib.openapi.validate_against_openapi_schema函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论