From d036a015164fbbb6efd342b362f737a4b64dfe5e Mon Sep 17 00:00:00 2001 From: orientor Date: Sat, 1 Aug 2020 04:55:34 +0530 Subject: [PATCH] test_events: Convert tuples to arrays for OpenAPI testing. Use `ujson.loads(ujson.dumps())` wrapper on events sent for OpenAPI testing so that all tuples are converted into arrays as tuples aren't valid in JSON. --- zerver/tests/test_events.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py index 120ce44af0..3d33033c52 100644 --- a/zerver/tests/test_events.py +++ b/zerver/tests/test_events.py @@ -222,7 +222,9 @@ class BaseAction(ZulipTestCase): events = client.event_queue.contents() content = { 'queue_id': '123.12', - 'events': copy.deepcopy(events), + # The ujson wrapper helps in converting tuples to lists + # as tuples aren't valid JSON structure. + 'events': ujson.loads(ujson.dumps(copy.deepcopy(events))), 'msg': '', 'result': 'success' }