api docs: Migrate POST /messages to OpenAPI.

This commit is contained in:
Yago González
2018-06-18 18:15:08 +02:00
committed by Tim Abbott
parent cb24756edc
commit 7ddc6e8d10
5 changed files with 111 additions and 51 deletions

View File

@@ -307,9 +307,7 @@ def send_message(client):
result = client.send_message(request)
# {code_example|end}
fixture = FIXTURES['send-message']
test_against_fixture(result, fixture, check_if_equal=['result'],
check_if_exists=['id'])
validate_against_openapi_schema(result, '/messages', 'post', '200')
# test that the message was actually sent
message_id = result['id']
@@ -331,8 +329,7 @@ def send_message(client):
result = client.send_message(request)
# {code_example|end}
test_against_fixture(result, fixture, check_if_equal=['result'],
check_if_exists=['id'])
validate_against_openapi_schema(result, '/messages', 'post', '200')
# test that the message was actually sent
message_id = result['id']
@@ -356,8 +353,8 @@ def test_nonexistent_stream_error(client):
}
result = client.send_message(request)
fixture = FIXTURES['nonexistent-stream-error']
test_against_fixture(result, fixture)
validate_against_openapi_schema(result, '/messages', 'post',
'400_non_existing_stream')
def test_private_message_invalid_recipient(client):
# type: (Client) -> None
@@ -368,8 +365,8 @@ def test_private_message_invalid_recipient(client):
}
result = client.send_message(request)
fixture = FIXTURES['invalid-pm-recipient-error']
test_against_fixture(result, fixture)
validate_against_openapi_schema(result, '/messages', 'post',
'400_non_existing_user')
def update_message(client, message_id):
# type: (Client, int) -> None
@@ -503,7 +500,7 @@ def test_invalid_stream_error(client):
TEST_FUNCTIONS = {
'render-message': render_message,
'send-message': send_message,
'/messages:post': send_message,
'/messages/{message_id}:patch': update_message,
'get-stream-id': get_stream_id,
'get-subscribed-streams': list_subscriptions,