openapi: Document /register and add tests for it.

We'll want to do more iteration on the details here, but this is a
huge milestone.

Fixes #14188.
This commit is contained in:
orientor 2020-08-04 18:42:00 +05:30 committed by Tim Abbott
parent 004b6f2e62
commit 1d88c9e12e
3 changed files with 1517 additions and 1 deletions

View File

@ -18,7 +18,7 @@ OPENAPI_SPEC_PATH = os.path.abspath(os.path.join(
EXCLUDE_UNDOCUMENTED_ENDPOINTS = {"/realm/emoji/{emoji_name}:delete", "/users:patch"} EXCLUDE_UNDOCUMENTED_ENDPOINTS = {"/realm/emoji/{emoji_name}:delete", "/users:patch"}
# Consists of endpoints with some documentation remaining. # Consists of endpoints with some documentation remaining.
# These are skipped but return true as the validator cannot exclude objects # These are skipped but return true as the validator cannot exclude objects
EXCLUDE_DOCUMENTED_ENDPOINTS = {"/register:post", "/settings/notifications:patch"} EXCLUDE_DOCUMENTED_ENDPOINTS = {"/settings/notifications:patch"}
class OpenAPISpec(): class OpenAPISpec():
def __init__(self, path: str) -> None: def __init__(self, path: str) -> None:
self.path = path self.path = path

View File

@ -871,6 +871,15 @@ def update_message_flags(client: Client) -> None:
validate_against_openapi_schema(result, '/messages/flags', 'post', validate_against_openapi_schema(result, '/messages/flags', 'post',
'200') '200')
def register_queue_all_events(client: Client) -> str:
# Register the queue and get all events
# Mainly for verifying schema of /register.
result = client.register()
validate_against_openapi_schema(result, '/register', 'post', '200')
return result['queue_id']
@openapi_test_function("/register:post") @openapi_test_function("/register:post")
def register_queue(client: Client) -> str: def register_queue(client: Client) -> str:
@ -1215,6 +1224,7 @@ def test_queues(client: Client) -> None:
# the effort to come up with asynchronous logic for testing those here. # the effort to come up with asynchronous logic for testing those here.
queue_id = register_queue(client) queue_id = register_queue(client)
deregister_queue(client, queue_id) deregister_queue(client, queue_id)
register_queue_all_events(client)
def test_server_organizations(client: Client) -> None: def test_server_organizations(client: Client) -> None:

File diff suppressed because it is too large Load Diff