Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust event streams refresh unit testing to address flakiness #1242

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions tests/test_event_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand All @@ -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}",
Expand Down
Loading