Skip to content

Commit

Permalink
Unit test fixes for the new simple clients (Fixes #1265)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Oct 29, 2023
1 parent 8cc84bd commit 66b9586
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions tests/async/test_simple_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_connect(self):
'url', headers='h', auth='a', transports='t',
namespaces=['n'], socketio_path='s', wait_timeout='w')
mock_client().event.call_count == 3
mock_client().on.called_once_with('*')
mock_client().on.assert_called_once_with('*', namespace='n')
assert client.namespace == 'n'
assert not client.input_event.is_set()

Expand All @@ -52,7 +52,8 @@ async def _t():
'url', headers='h', auth='a', transports='t',
namespaces=['n'], socketio_path='s', wait_timeout='w')
mock_client().event.call_count == 3
mock_client().on.called_once_with('*')
mock_client().on.assert_called_once_with(
'*', namespace='n')
assert client.namespace == 'n'
assert not client.input_event.is_set()

Expand Down Expand Up @@ -85,7 +86,7 @@ def test_emit(self):
client.connected = True

_run(client.emit('foo', 'bar'))
assert client.client.emit.mock.called_once_with('foo', 'bar',
client.client.emit.mock.assert_called_once_with('foo', 'bar',
namespace='/ns')

def test_emit_disconnected(self):
Expand Down Expand Up @@ -116,9 +117,8 @@ def test_call(self):
client.connected = True

assert _run(client.call('foo', 'bar')) == 'result'
assert client.client.call.mock.called_once_with('foo', 'bar',
namespace='/ns',
timeout=60)
client.client.call.mock.assert_called_once_with(
'foo', 'bar', namespace='/ns', timeout=60)

def test_call_disconnected(self):
client = AsyncSimpleClient()
Expand Down
10 changes: 5 additions & 5 deletions tests/common/test_simple_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_connect(self):
'url', headers='h', auth='a', transports='t',
namespaces=['n'], socketio_path='s', wait_timeout='w')
mock_client().event.call_count == 3
mock_client().on.called_once_with('*')
mock_client().on.assert_called_once_with('*', namespace='n')
assert client.namespace == 'n'
assert not client.input_event.is_set()

Expand All @@ -41,7 +41,7 @@ def test_connect_context_manager(self):
'url', headers='h', auth='a', transports='t',
namespaces=['n'], socketio_path='s', wait_timeout='w')
mock_client().event.call_count == 3
mock_client().on.called_once_with('*')
mock_client().on.assert_called_once_with('*', namespace='n')
assert client.namespace == 'n'
assert not client.input_event.is_set()

Expand Down Expand Up @@ -71,7 +71,7 @@ def test_emit(self):
client.connected = True

client.emit('foo', 'bar')
assert client.client.emit.called_once_with('foo', 'bar',
client.client.emit.assert_called_once_with('foo', 'bar',
namespace='/ns')

def test_emit_disconnected(self):
Expand Down Expand Up @@ -100,8 +100,8 @@ def test_call(self):
client.connected = True

assert client.call('foo', 'bar') == 'result'
client.client.call.called_once_with('foo', 'bar', namespace='/ns',
timeout=60)
client.client.call.assert_called_once_with('foo', 'bar',
namespace='/ns', timeout=60)

def test_call_disconnected(self):
client = SimpleClient()
Expand Down

0 comments on commit 66b9586

Please sign in to comment.