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.
This commit is contained in:
orientor 2020-08-01 04:55:34 +05:30 committed by Tim Abbott
parent f26d0affef
commit d036a01516
1 changed files with 3 additions and 1 deletions

View File

@ -222,7 +222,9 @@ class BaseAction(ZulipTestCase):
events = client.event_queue.contents() events = client.event_queue.contents()
content = { content = {
'queue_id': '123.12', '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': '', 'msg': '',
'result': 'success' 'result': 'success'
} }