Esempio n. 1
0
 def test_connect_settimeout(self):
     connection = Connection('host', 1)
     with mock.patch('socket.socket'):
         connection._connect()
         connection._sock.settimeout.assert_called_with(10)
Esempio n. 2
0
 def _get_connection(self):
     # TODO: Try random trackers, implement retries
     host, port = self._trackers[0]
     connection = Connection(host, port)
     connection._connect()
     return connection
Esempio n. 3
0
 def test_connect(self):
     connection = Connection('host', 1)
     with mock.patch('socket.socket'):
         connection._connect()
         connection._sock.connect.assert_called_with(('host', 1))