def test_close(self, mock_socket): conn = TcpConnection('localhost', 2000) conn.open() conn.close() conn.get().close.assert_called_once_with() ok_(not conn.is_connected())
def test_recv(self, mock_socket): conn = TcpConnection('localhost', 2000) conn.open() conn.recv(20) conn.get().recv.assert_called_once_with(20)
def test_send(self, mock_socket): conn = TcpConnection('localhost', 2000) conn.open() conn.send('dummy') conn.get().send.assert_called_once_with('dummy')
def test_open_with_timeout(self, mock_socket): conn = TcpConnection('localhost', 2000, timeout=10) conn.open() conn.get().settimeout.assert_called_once_with(10)
def test_open(self, mock_socket): conn = TcpConnection('localhost', 2000) conn.open() conn.get().connect.assert_called_once_with(('localhost', 2000)) ok_(conn.is_connected())