Skip to content

Commit

Permalink
client disconnect does not take namespace as argument
Browse files Browse the repository at this point in the history
Fixes #259
  • Loading branch information
miguelgrinberg committed Feb 27, 2019
1 parent f752312 commit c354514
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
5 changes: 2 additions & 3 deletions socketio/asyncio_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async def send(self, data, namespace=None, callback=None):
namespace=namespace or self.namespace,
callback=callback)

async def disconnect(self, namespace=None):
async def disconnect(self):
"""Disconnect a client.
The only difference with the :func:`socketio.Client.disconnect` method
Expand All @@ -201,5 +201,4 @@ async def disconnect(self, namespace=None):
Note: this method is a coroutine.
"""
return await self.client.disconnect(
namespace=namespace or self.namespace)
return await self.client.disconnect()
4 changes: 2 additions & 2 deletions socketio/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ def send(self, data, room=None, skip_sid=None, namespace=None,
return self.client.send(data, namespace=namespace or self.namespace,
callback=callback)

def disconnect(self, namespace=None):
def disconnect(self):
"""Disconnect from the server.
The only difference with the :func:`socketio.Client.disconnect` method
is that when the ``namespace`` argument is not given the namespace
associated with the class is used.
"""
return self.client.disconnect(namespace=namespace or self.namespace)
return self.client.disconnect()
4 changes: 1 addition & 3 deletions tests/asyncio/test_asyncio_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,4 @@ def test_disconnect_client(self):
mock_client.disconnect = AsyncMock()
ns._set_client(mock_client)
_run(ns.disconnect())
ns.client.disconnect.mock.assert_called_with(namespace='/foo')
_run(ns.disconnect(namespace='/bar'))
ns.client.disconnect.mock.assert_called_with(namespace='/bar')
ns.client.disconnect.mock.assert_called_with()
4 changes: 1 addition & 3 deletions tests/common/test_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,4 @@ def test_disconnect_client(self):
ns = namespace.ClientNamespace('/foo')
ns._set_client(mock.MagicMock())
ns.disconnect()
ns.client.disconnect.assert_called_with(namespace='/foo')
ns.disconnect(namespace='/bar')
ns.client.disconnect.assert_called_with(namespace='/bar')
ns.client.disconnect.assert_called_with()

0 comments on commit c354514

Please sign in to comment.