def test_handle_accept_typeerror(self): # https://github.com/giampaolo/pyftpdlib/issues/91 ac = Acceptor() with mock.patch.object(ac, "accept", side_effect=TypeError) as m: ac.handle_accept() assert m.called self.assertIsNone(ac.socket)
def test_handle_accept_econnacorted(self): # https://github.com/giampaolo/pyftpdlib/issues/105 ac = Acceptor() with mock.patch.object( ac, "accept", side_effect=socket.error(errno.ECONNABORTED, "")) as m: ac.handle_accept() assert m.called self.assertIsNone(ac.socket)
def test_handle_accept_econnacorted(self): # https://github.com/giampaolo/pyftpdlib/issues/105 ac = Acceptor() with mock.patch.object(ac, "accept", side_effect=socket.error( errno.ECONNABORTED, "")) as m: ac.handle_accept() assert m.called self.assertIsNone(ac.socket)