api-docs: Fix documentation of realm_emoji in register response.

Fixes the `/api/register-queue` endpoint documentation so that the
`realm_emoji` has the correct type, object that contains objects.

By correcting the API documentation, we also fix an error in the
test for the events system, which had been relying on the API
documentation having a list as a possible type for `realm_emoji`
in the register response.
This commit is contained in:
Lauryn Menard
2023-08-16 20:53:41 +02:00
committed by Tim Abbott
parent 38250ccb83
commit 1713449639
2 changed files with 8 additions and 11 deletions

View File

@@ -11415,15 +11415,11 @@ paths:
description: |
Present if `realm_emoji` is present in `fetch_event_types`.
An array of dictionaries where each dictionary describes a custom
A dictionary of objects where each object describes a custom
emoji that has been uploaded in this Zulip organization.
oneOf:
- type: object
additionalProperties:
$ref: "#/components/schemas/RealmEmoji"
- type: array
items:
type: integer
type: object
additionalProperties:
$ref: "#/components/schemas/RealmEmoji"
realm_linkifiers:
type: array
description: |

View File

@@ -89,7 +89,8 @@ class EventsEndpointTest(ZulipTestCase):
# We choose realm_emoji somewhat randomly--we want
# a "boring" event type for the purpose of this test.
event_type = "realm_emoji"
test_event = dict(id=6, type=event_type, realm_emoji=[])
empty_realm_emoji_dict: Dict[str, Any] = {}
test_event = dict(id=6, type=event_type, realm_emoji=empty_realm_emoji_dict)
# Test that call is made to deal with a returning soft deactivated user.
with mock.patch("zerver.lib.events.reactivate_user_if_soft_deactivated") as fa:
@@ -122,7 +123,7 @@ class EventsEndpointTest(ZulipTestCase):
self.assertEqual(result_dict["queue_id"], "15:12")
# sanity check the data relevant to our event
self.assertEqual(result_dict["realm_emoji"], [])
self.assertEqual(result_dict["realm_emoji"], {})
# Now test with `fetch_event_types` not matching the event
return_event_queue = "15:13"
@@ -161,7 +162,7 @@ class EventsEndpointTest(ZulipTestCase):
# Check that the realm_emoji data is in there.
self.assertIn("realm_emoji", result_dict)
self.assertEqual(result_dict["realm_emoji"], [])
self.assertEqual(result_dict["realm_emoji"], {})
self.assertEqual(result_dict["queue_id"], "15:13")
def test_events_register_spectators(self) -> None: