def test_close(self): throttler = AsyncThrottler(CONSTANTS.RATE_LIMITS) ws = AsyncMock() adaptor = NdaxWebSocketAdaptor(throttler, websocket=ws) asyncio.get_event_loop().run_until_complete(adaptor.close()) self.assertEquals(1, ws.close.await_count)
def test_close(self, mock_ws): throttler = AsyncThrottler(CONSTANTS.RATE_LIMITS) mock_ws.return_value = self.mocking_assistant.create_websocket_mock() adaptor = NdaxWebSocketAdaptor(throttler, websocket=mock_ws.return_value) self.async_run_with_timeout(adaptor.close()) self.assertEquals(1, mock_ws.return_value.close.await_count)
def test_close(self, mock_ws): throttler = AsyncThrottler(CONSTANTS.RATE_LIMITS) mock_ws.return_value = self.mocking_assistant.create_websocket_mock() adaptor = NdaxWebSocketAdaptor(throttler, websocket=mock_ws.return_value) asyncio.get_event_loop().run_until_complete(adaptor.close()) self.assertEquals(1, mock_ws.return_value.close.await_count)