Esempio n. 1
0
 def test_disconnect_client(self):
     ns = asyncio_namespace.AsyncClientNamespace('/foo')
     mock_client = mock.MagicMock()
     mock_client.disconnect = AsyncMock()
     ns._set_client(mock_client)
     _run(ns.disconnect())
     ns.client.disconnect.mock.assert_called_with()
Esempio n. 2
0
 def test_send_client(self):
     ns = asyncio_namespace.AsyncClientNamespace('/foo')
     mock_client = mock.MagicMock()
     mock_client.send = AsyncMock()
     ns._set_client(mock_client)
     _run(ns.send(data='data', callback='cb'))
     ns.client.send.mock.assert_called_with('data',
                                            namespace='/foo',
                                            callback='cb')
     _run(ns.send(data='data', namespace='/bar', callback='cb'))
     ns.client.send.mock.assert_called_with('data',
                                            namespace='/bar',
                                            callback='cb')