generated from daniil-berg/boilerplate-py
fixed unix server/client tests
This commit is contained in:
parent
d05f84b2c3
commit
eb152e4d75
@ -190,9 +190,9 @@ class UnixControlClientTestCase(IsolatedAsyncioTestCase):
|
|||||||
self.mock_base_init.assert_called_once_with(**self.kwargs)
|
self.mock_base_init.assert_called_once_with(**self.kwargs)
|
||||||
|
|
||||||
@patch.object(client, 'print')
|
@patch.object(client, 'print')
|
||||||
@patch.object(client, 'open_unix_connection')
|
async def test__open_connection(self, mock_print: MagicMock):
|
||||||
async def test__open_connection(self, mock_open_unix_connection: AsyncMock, mock_print: MagicMock):
|
expected_output = 'something'
|
||||||
mock_open_unix_connection.return_value = expected_output = 'something'
|
self.client._open_unix_connection = mock_open_unix_connection = AsyncMock(return_value=expected_output)
|
||||||
kwargs = {'a': 1, 'b': 2}
|
kwargs = {'a': 1, 'b': 2}
|
||||||
output = await self.client._open_connection(**kwargs)
|
output = await self.client._open_connection(**kwargs)
|
||||||
self.assertEqual(expected_output, output)
|
self.assertEqual(expected_output, output)
|
||||||
|
@ -151,9 +151,9 @@ class UnixControlServerTestCase(IsolatedAsyncioTestCase):
|
|||||||
self.assertEqual(Path(self.path), self.server._socket_path)
|
self.assertEqual(Path(self.path), self.server._socket_path)
|
||||||
self.mock_base_init.assert_called_once_with(self.mock_pool, **self.kwargs)
|
self.mock_base_init.assert_called_once_with(self.mock_pool, **self.kwargs)
|
||||||
|
|
||||||
@patch.object(server, 'start_unix_server')
|
async def test__get_server_instance(self):
|
||||||
async def test__get_server_instance(self, mock_start_unix_server: AsyncMock):
|
expected_output = 'totally_a_server'
|
||||||
mock_start_unix_server.return_value = expected_output = 'totally_a_server'
|
self.server._start_unix_server = mock_start_unix_server = AsyncMock(return_value=expected_output)
|
||||||
mock_callback, mock_kwargs = MagicMock(), {'a': 1, 'b': 2}
|
mock_callback, mock_kwargs = MagicMock(), {'a': 1, 'b': 2}
|
||||||
args = [mock_callback]
|
args = [mock_callback]
|
||||||
output = await self.server._get_server_instance(*args, **mock_kwargs)
|
output = await self.server._get_server_instance(*args, **mock_kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user