def test_recv(self, mock_socket): conn = TcpConnection('localhost', 2000) conn.open() conn.recv(20) conn.socket.recv.assert_called_once_with(20)