Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion massive/websocket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def _parse_subscription(s: str):
s = s.strip()
split = s.split(".", 1) # Split at the first period
if len(split) != 2:
logger.warning("invalid subscription:", s)
logger.warning("invalid subscription: %s", s)
return [None, None]

return split
Expand Down
10 changes: 10 additions & 0 deletions test_websocket/test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,13 @@ async def test_auth_reply_status_is_logged(self):
"Maximum number of websocket connections exceeded."
],
)

async def test_invalid_subscription_is_logged(self):
# a topic without a channel prefix is skipped with a warning
c = WebSocketClient(api_key="")
with self.assertLogs("WebSocketClient", level="WARNING") as logs:
c.subscribe("AAPL")
self.assertEqual(
logs.output, ["WARNING:WebSocketClient:invalid subscription: AAPL"]
)
self.assertEqual(c.scheduled_subs, set())
Loading