def setUp(self): super(ExitRequestInitTestCase, self).setUp() self.mock_unpack = patch_object(exitrequest.struct, 'unpack').start() self.mock_ip_address = patch_object(exitrequest.ipaddress, 'ip_address').start() self.mock_unpack.return_value = ['port']
def setUp(self): super(RelayExtend2CellMakeTestCase, self).setUp() self.mock_fixedlen_header = patch_object( relay.FixedLenCell, 'Header').start() self.mock_relay_header = patch_object( relay.RelayCell, 'RelayHeader').start() self.mock_relay_extend_2_cell = patch_object( relay, 'RelayExtend2Cell').start()
def setUp(self): super(CircuitCanHandleRequestTestCase, self).setUp() self.mock_selector = patch_object(circuit, 'PathSelector').start() self.mock_deferred_queue = patch_object(circuit.defer, 'DeferredQueue').start() self.mock_start_building = patch_object(Circuit, '_startBuilding').start() self.circuit = Circuit(1, Mock()) self.circuit.path = Mock() self.mock_can_exit_to = patch_object( self.circuit.path.exit.exit_policy, 'can_exit_to').start()
def setUp(self): super(CircuitCanHandleRequestTestCase, self).setUp() self.mock_selector = patch_object(circuit, 'PathSelector').start() self.mock_deferred_queue = patch_object( circuit.defer, 'DeferredQueue').start() self.mock_start_building = patch_object( Circuit, '_startBuilding').start() self.circuit = Circuit(1, Mock()) self.circuit.path = Mock() self.mock_can_exit_to = patch_object( self.circuit.path.exit.exit_policy, 'can_exit_to').start()
def setUp(self): super(V3FSMProcessVersionsTestCase, self).setUp() self.transport = Mock() self.v3fsm = V3FSM(self.transport) self.mock_verify_cell_cmd = patch.object(V3FSM, '_verifyCellCmd').start() self.mock_handshake_supported = patch_object( self.v3fsm, 'handshakeSupported').start()
def setUp(self): super(V3FSMProcessVersionsTestCase, self).setUp() self.transport = Mock() self.v3fsm = V3FSM(self.transport) self.mock_verify_cell_cmd = patch.object( V3FSM, '_verifyCellCmd').start() self.mock_handshake_supported = patch_object( self.v3fsm, 'handshakeSupported').start()
def setUp(self): super(OppySOCKSProtocolHandleRequestHelperTestCase, self).setUp() self.protocol = OppySOCKSProtocol() self.protocol.transport = Mock() self.mock_logging = patch_object(socks, 'logging').start() self.mock_send_reply = patch_object(self.protocol, '_sendReply').start() self.mock_lose_connection = patch_object( self.protocol.transport, 'loseConnection').start() self.mock_exit_request = patch_object(socks, 'ExitRequest').start() self.mock_unpack = patch_object(socks.struct, 'unpack').start() self.mock_stream = patch_object(socks, 'Stream').start() self.mock_unpack.return_value = [5] self.request = Mock() self.protocol.request = self.request
def setUp(self): super(OppySOCKSProtocolHandleRequestHelperTestCase, self).setUp() self.protocol = OppySOCKSProtocol() self.protocol.transport = Mock() self.mock_logging = patch_object(socks, 'logging').start() self.mock_send_reply = patch_object(self.protocol, '_sendReply').start() self.mock_lose_connection = patch_object(self.protocol.transport, 'loseConnection').start() self.mock_exit_request = patch_object(socks, 'ExitRequest').start() self.mock_unpack = patch_object(socks.struct, 'unpack').start() self.mock_stream = patch_object(socks, 'Stream').start() self.mock_unpack.return_value = [5] self.request = Mock() self.protocol.request = self.request
def setUp(self): super(V3FSMProcessCertsHelperTestCase, self).setUp() self.transport = Mock() self.v3fsm = V3FSM(self.transport) self.mock_verify_cell_cmd = patch.object(V3FSM, '_verifyCellCmd').start() self.mock_der_cert_to_pem_cert = patch_object( v3.ssl, 'DER_cert_to_PEM_cert').start() self.mock_load_certificate = patch_object(v3.SSLCrypto, 'load_certificate').start() self.mock_get_peer_certificate = patch_object( self.transport, 'getPeerCertificate').start() self.mock_valid_cert_time = patch_object(v3.crypto_util, 'validCertTime').start() self.mock_dump_privatekey = patch_object(v3.SSLCrypto, 'dump_privatekey').start() self.mock_verify_cert_sig = patch_object(v3.crypto_util, 'verifyCertSig').start() self.mock_link_cert = Mock() self.mock_id_cert = Mock() self.mock_load_certificate.side_effect = iter( [self.mock_link_cert, self.mock_id_cert]) self.mock_conn_cert = self.mock_get_peer_certificate.return_value self.mock_id_key = self.mock_id_cert.get_pubkey.return_value self.mock_id_key.type.return_value = 6 self.mock_id_key.bits.return_value = 1024 self.mock_verify_cert_sig.return_value = True
def setUp(self): super(V3FSMProcessCertsHelperTestCase, self).setUp() self.transport = Mock() self.v3fsm = V3FSM(self.transport) self.mock_verify_cell_cmd = patch.object( V3FSM, '_verifyCellCmd').start() self.mock_der_cert_to_pem_cert = patch_object( v3.ssl, 'DER_cert_to_PEM_cert').start() self.mock_load_certificate = patch_object( v3.SSLCrypto, 'load_certificate').start() self.mock_get_peer_certificate = patch_object( self.transport, 'getPeerCertificate').start() self.mock_valid_cert_time = patch_object( v3.crypto_util, 'validCertTime').start() self.mock_dump_privatekey = patch_object( v3.SSLCrypto, 'dump_privatekey').start() self.mock_verify_cert_sig = patch_object( v3.crypto_util, 'verifyCertSig').start() self.mock_link_cert = Mock() self.mock_id_cert = Mock() self.mock_load_certificate.side_effect = iter([ self.mock_link_cert, self.mock_id_cert]) self.mock_conn_cert = self.mock_get_peer_certificate.return_value self.mock_id_key = self.mock_id_cert.get_pubkey.return_value self.mock_id_key.type.return_value = 6 self.mock_id_key.bits.return_value = 1024 self.mock_verify_cert_sig.return_value = True
def setUp(self): super(CellParseTestCase, self).setUp() self.mock_struct = patch_object(cell, 'struct').start() self.mock_struct.calcsize.return_value = 5
def setUp(self): super(CellEnoughDataForCellTestCase, self).setUp() self.mock_struct = patch_object(cell, 'struct').start()
def setUp(self): super(CircuitManagerCircuitOpenedTestCase, self).setUp() self.cm = CircuitManager() self.mock_logging = patch_object(cm, 'logging').start() self.mock_assign_possible_pending_requests = patch_object( self.cm, '_assignPossiblePendingRequests').start()
def setUp(self): super(CellParseTestCase, self).setUp() self.mock_struct = patch_object(cell, 'struct').start() self.mock_struct.calcsize.return_value = 5
def setUp(self): super(CellEnoughDataForCellTestCase, self).setUp() self.mock_struct = patch_object(cell, 'struct').start()
def setUp(self): super(CircuitManagerCircuitOpenedTestCase, self).setUp() self.cm = CircuitManager() self.mock_logging = patch_object(cm, 'logging').start() self.mock_assign_possible_pending_requests = patch_object( self.cm, '_assignPossiblePendingRequests').start()