diff --git a/tests/test_event_streams.py b/tests/test_event_streams.py index 04e541c82..712232e98 100644 --- a/tests/test_event_streams.py +++ b/tests/test_event_streams.py @@ -40,12 +40,12 @@ def stream_refresh(): """refresh_active_stream""" avail = falcon.listAvailableStreamsOAuth2(parameters={"appId": f"{APP_ID}"}) current_time = datetime.now(timezone.utc).strftime('%a, %d %b %Y %H:%M:%S +0000') - headers = { - 'Authorization': 'Token %s' % ( - avail["body"]["resources"][0]["sessionToken"]["token"] - ), 'Date': current_time, 'Connection': 'Keep-Alive' - } if avail["body"]["resources"]: + headers = { + 'Authorization': 'Token %s' % ( + avail["body"]["resources"][0]["sessionToken"]["token"] + ), 'Date': current_time, 'Connection': 'Keep-Alive' + } stream = requests.get(avail["body"]["resources"][0]["dataFeedURL"], headers=headers, stream=True) with stream: result = falcon.refreshActiveStreamSession(app_id=f"{APP_ID}", @@ -61,12 +61,13 @@ def stream_refresh_default_action(): """refresh_active_stream""" avail = falcon.listAvailableStreamsOAuth2(parameters={"appId": f"{APP_ID}"}) current_time = datetime.now(timezone.utc).strftime('%a, %d %b %Y %H:%M:%S +0000') - headers = { - 'Authorization': 'Token %s' % ( - avail["body"]["resources"][0]["sessionToken"]["token"] - ), 'Date': current_time, 'Connection': 'Keep-Alive' - } if avail["body"]["resources"]: + headers = { + 'Authorization': 'Token %s' % ( + avail["body"]["resources"][0]["sessionToken"]["token"] + ), 'Date': current_time, 'Connection': 'Keep-Alive' + } + stream = requests.get(avail["body"]["resources"][0]["dataFeedURL"], headers=headers, stream=True) with stream: result = falcon.refreshActiveStreamSession(appId=f"{APP_ID}",