Skip to content

Commit

Permalink
Added tests for performing actions before calling login()
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgolec committed Jun 1, 2020
1 parent d49687c commit a82ecf5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/streaming_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3061,3 +3061,13 @@ async def test_multiple_data_per_message(self, ws_connect):
await self.client.handle_message()
handler_1.assert_has_calls(
[call(stream_item['data'][0]), call(stream_item['data'][1])])

@patch('tda.streaming.websockets.client.connect', autospec=AsyncMock())
async def test_handle_message_without_login(self, ws_connect):
with self.assertRaisesRegex(ValueError, '.*Socket not open.*'):
await self.client.handle_message()

@patch('tda.streaming.websockets.client.connect', autospec=AsyncMock())
async def test_subscribe_without_login(self, ws_connect):
with self.assertRaisesRegex(ValueError, '.*Socket not open.*'):
await self.client.chart_equity_subs(['GOOG,MSFT'])

0 comments on commit a82ecf5

Please sign in to comment.