From a99b96d9dbd29c07fc2b1fc56de74b5639d74f26 Mon Sep 17 00:00:00 2001 From: Vishnu Ks Date: Wed, 23 Oct 2019 08:18:10 +0000 Subject: [PATCH] tests: Remove get-events-from-queue from curl test exclude_list. --- zerver/openapi/curl_param_value_generators.py | 15 ++++++++++++++- zerver/openapi/test_curl_examples.py | 1 - 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/zerver/openapi/curl_param_value_generators.py b/zerver/openapi/curl_param_value_generators.py index 09ee2fb13a..873786cb2a 100644 --- a/zerver/openapi/curl_param_value_generators.py +++ b/zerver/openapi/curl_param_value_generators.py @@ -2,8 +2,9 @@ from typing import Dict, Any, Callable, Set, List from functools import wraps -from zerver.models import get_realm, get_user +from zerver.models import get_realm, get_user, Client from zerver.lib.test_classes import ZulipTestCase +from zerver.lib.events import do_events_register GENERATOR_FUNCTIONS = dict() # type: Dict[str, Callable[..., Dict[Any, Any]]] REGISTERED_GENERATOR_FUNCTIONS = set() # type: Set[str] @@ -96,3 +97,15 @@ def update_subscription_data() -> Dict[str, List[Dict[str, Any]]]: {"stream_id": helpers.get_stream_id("social"), "property": "color", "value": "#f00f00"} ] } + +@openapi_param_value_generator(["/events:get"]) +def get_events() -> Dict[str, Any]: + bot_profile = get_user("default-bot@zulip.com", get_realm("zulip")) + helpers.subscribe(bot_profile, "Verona") + client = Client.objects.create(name="curl-test-client-1") + response = do_events_register(bot_profile, client, event_types=['message', 'realm_emoji']) + helpers.send_stream_message(helpers.example_email("hamlet"), "Verona") + return { + "queue_id": response["queue_id"], + "last_event_id": response["last_event_id"], + } diff --git a/zerver/openapi/test_curl_examples.py b/zerver/openapi/test_curl_examples.py index 5ca5e1a80c..4b3aa88fd1 100644 --- a/zerver/openapi/test_curl_examples.py +++ b/zerver/openapi/test_curl_examples.py @@ -21,7 +21,6 @@ exclude_list = [ 'create-user-group.md', 'update-user-group.md', 'delete-user-group.md', - 'get-events-from-queue.md', 'delete-queue.md', 'update-stream.md', # Endpoint can be called only by administrators.