From 2f5f23ecc6aeeed041d738876e8c07ffece5d33f Mon Sep 17 00:00:00 2001 From: Vishnu Ks Date: Wed, 23 Oct 2019 11:09:06 +0000 Subject: [PATCH] tests: Remove get-presence from curl test exclude_list. --- zerver/openapi/curl_param_value_generators.py | 12 +++++++++++- zerver/openapi/test_curl_examples.py | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/zerver/openapi/curl_param_value_generators.py b/zerver/openapi/curl_param_value_generators.py index 2a9da5c761..3b21721576 100644 --- a/zerver/openapi/curl_param_value_generators.py +++ b/zerver/openapi/curl_param_value_generators.py @@ -2,9 +2,12 @@ from typing import Dict, Any, Callable, Set, List from functools import wraps -from zerver.models import get_realm, get_user, Client +from django.utils.timezone import now as timezone_now + +from zerver.models import get_realm, get_user, Client, UserPresence from zerver.lib.test_classes import ZulipTestCase from zerver.lib.events import do_events_register +from zerver.lib.actions import update_user_presence GENERATOR_FUNCTIONS = dict() # type: Dict[str, Callable[..., Dict[Any, Any]]] REGISTERED_GENERATOR_FUNCTIONS = set() # type: Set[str] @@ -119,3 +122,10 @@ def delete_event_queue() -> Dict[str, Any]: "queue_id": response["queue_id"], "last_event_id": response["last_event_id"], } + +@openapi_param_value_generator(["/users/{email}/presence:get"]) +def get_user_presence() -> Dict[None, None]: + iago = helpers.example_user("iago") + client = Client.objects.create(name="curl-test-client-3") + update_user_presence(iago, client, timezone_now(), UserPresence.ACTIVE, False) + return {} diff --git a/zerver/openapi/test_curl_examples.py b/zerver/openapi/test_curl_examples.py index 81d762788a..582331cdb1 100644 --- a/zerver/openapi/test_curl_examples.py +++ b/zerver/openapi/test_curl_examples.py @@ -17,7 +17,6 @@ exclude_list = [ 'delete-message.md', 'remove-subscriptions.md', 'delete-stream.md', - 'get-presence.md', 'create-user-group.md', 'update-user-group.md', 'delete-user-group.md',