Browse Source
Fixed transport property of the simple clients to be a string as documented (Fixes #1499)
pull/1500/head
Miguel Grinberg
2 weeks ago
Failed to extract signature
4 changed files with
4 additions and
4 deletions
-
src/socketio/async_simple_client.py
-
src/socketio/simple_client.py
-
tests/async/test_simple_client.py
-
tests/common/test_simple_client.py
|
|
@ -105,7 +105,7 @@ class AsyncSimpleClient: |
|
|
|
The transport is returned as a string and can be one of ``polling`` |
|
|
|
and ``websocket``. |
|
|
|
""" |
|
|
|
return self.client.transport if self.client else '' |
|
|
|
return self.client.transport() if self.client else '' |
|
|
|
|
|
|
|
async def emit(self, event, data=None): |
|
|
|
"""Emit an event to the server. |
|
|
|
|
|
@ -103,7 +103,7 @@ class SimpleClient: |
|
|
|
The transport is returned as a string and can be one of ``polling`` |
|
|
|
and ``websocket``. |
|
|
|
""" |
|
|
|
return self.client.transport if self.client else '' |
|
|
|
return self.client.transport() if self.client else '' |
|
|
|
|
|
|
|
def emit(self, event, data=None): |
|
|
|
"""Emit an event to the server. |
|
|
|
|
|
@ -72,7 +72,7 @@ class TestAsyncAsyncSimpleClient: |
|
|
|
|
|
|
|
async def test_properties(self): |
|
|
|
client = AsyncSimpleClient() |
|
|
|
client.client = mock.MagicMock(transport='websocket') |
|
|
|
client.client = mock.MagicMock(transport=lambda: 'websocket') |
|
|
|
client.client.get_sid.return_value = 'sid' |
|
|
|
client.connected_event.set() |
|
|
|
client.connected = True |
|
|
|
|
|
@ -64,7 +64,7 @@ class TestSimpleClient: |
|
|
|
|
|
|
|
def test_properties(self): |
|
|
|
client = SimpleClient() |
|
|
|
client.client = mock.MagicMock(transport='websocket') |
|
|
|
client.client = mock.MagicMock(transport=lambda: 'websocket') |
|
|
|
client.client.get_sid.return_value = 'sid' |
|
|
|
client.connected_event.set() |
|
|
|
client.connected = True |
|
|
|