diff --git a/tests/test_client.py b/tests/test_client.py index 4e83770..084c6d9 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -190,9 +190,9 @@ class UnixControlClientTestCase(IsolatedAsyncioTestCase): self.mock_base_init.assert_called_once_with(**self.kwargs) @patch.object(client, 'print') - @patch.object(client, 'open_unix_connection') - async def test__open_connection(self, mock_open_unix_connection: AsyncMock, mock_print: MagicMock): - mock_open_unix_connection.return_value = expected_output = 'something' + async def test__open_connection(self, mock_print: MagicMock): + expected_output = 'something' + self.client._open_unix_connection = mock_open_unix_connection = AsyncMock(return_value=expected_output) kwargs = {'a': 1, 'b': 2} output = await self.client._open_connection(**kwargs) self.assertEqual(expected_output, output) diff --git a/tests/test_server.py b/tests/test_server.py index c934bc1..f76027d 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -151,9 +151,9 @@ class UnixControlServerTestCase(IsolatedAsyncioTestCase): self.assertEqual(Path(self.path), self.server._socket_path) 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, mock_start_unix_server: AsyncMock): - mock_start_unix_server.return_value = expected_output = 'totally_a_server' + async def test__get_server_instance(self): + 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} args = [mock_callback] output = await self.server._get_server_instance(*args, **mock_kwargs)