def test_disconnect_failure(self):
     self.sock.sendall(b'QUIT\r\n')
     self.sock.recv(IsA(int)).AndRaise(socket_error(None, None))
     self.sock.close()
     self.mox.ReplayAll()
     client = SmtpRelayClient('addr', self.queue, socket_creator=self._socket_creator, ehlo_as='test')
     client._connect()
     client._disconnect()
Ejemplo n.º 2
0
 def test_disconnect_failure(self):
     self.sock.sendall('QUIT\r\n')
     self.sock.recv(IsA(int)).AndRaise(socket_error(None, None))
     self.sock.close()
     self.mox.ReplayAll()
     client = SmtpRelayClient(None, self.queue, socket_creator=self._socket_creator, ehlo_as='test')
     client._connect()
     client._disconnect()
Ejemplo n.º 3
0
 def test_run_socket_error(self):
     result = AsyncResult()
     env = Envelope('*****@*****.**', ['*****@*****.**'])
     env.parse(b'From: [email protected]\r\n\r\ntest test\r\n')
     queue = BlockingDeque()
     queue.append((result, env))
     self.sock.recv(IsA(int)).AndRaise(socket_error(None, None))
     self.sock.sendall(b'QUIT\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'221 Goodbye\r\n')
     self.sock.close()
     self.mox.ReplayAll()
     client = SmtpRelayClient(('addr', 0), queue, socket_creator=self._socket_creator, ehlo_as='there')
     client._run()
     with self.assertRaises(TransientRelayError):
         result.get_nowait()
Ejemplo n.º 4
0
 def test_run_socket_error(self):
     result = AsyncResult()
     env = Envelope('*****@*****.**', ['*****@*****.**'])
     env.parse(b'From: [email protected]\r\n\r\ntest test\r\n')
     queue = BlockingDeque()
     queue.append((result, env))
     self.sock.recv(IsA(int)).AndRaise(socket_error(None, None))
     self.sock.sendall(b'QUIT\r\n')
     self.sock.recv(IsA(int)).AndReturn(b'221 Goodbye\r\n')
     self.sock.close()
     self.mox.ReplayAll()
     client = SmtpRelayClient(('addr', 0),
                              queue,
                              socket_creator=self._socket_creator,
                              ehlo_as='there')
     client._run()
     with self.assertRaises(TransientRelayError):
         result.get_nowait()
 def socket_creator(address):
     raise socket_error(None, None)
Ejemplo n.º 6
0
 def socket_creator(address):
     raise socket_error(None, None)