diff --git a/tests/test_event_streams.py b/tests/test_event_streams.py index 39efafe90..04e541c82 100644 --- a/tests/test_event_streams.py +++ b/tests/test_event_streams.py @@ -45,13 +45,16 @@ def stream_refresh(): 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}", - action_name="refresh_active_stream_session", - partition=0 - ) - return bool(result["status_code"] in AllowedResponses) + if avail["body"]["resources"]: + stream = requests.get(avail["body"]["resources"][0]["dataFeedURL"], headers=headers, stream=True) + with stream: + result = falcon.refreshActiveStreamSession(app_id=f"{APP_ID}", + action_name="refresh_active_stream_session", + partition=0 + ) + return bool(result["status_code"] in AllowedResponses) + else: + pytest.skip("Rate limited") @staticmethod def stream_refresh_default_action(): @@ -63,13 +66,15 @@ def stream_refresh_default_action(): 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}", - partition="0" - ) - return bool(result["status_code"] in AllowedResponses) - + if avail["body"]["resources"]: + stream = requests.get(avail["body"]["resources"][0]["dataFeedURL"], headers=headers, stream=True) + with stream: + result = falcon.refreshActiveStreamSession(appId=f"{APP_ID}", + partition="0" + ) + return bool(result["status_code"] in AllowedResponses) + else: + pytest.skip("Rate limited") @staticmethod def stream_errors():