/usr/lib/python3/dist-packages/twisted/conch/test
NameSizeModeActions
__pycache__/-0755rm
keydata.py352080644editdlrm
loopback.py7060644editdlrm
test_address.py15500644editdlrm
test_agent.py132190644editdlrm
test_cftp.py505030644editdlrm
test_channel.py121830644editdlrm
test_checkers.py313400644editdlrm
test_ckeygen.py243390644editdlrm
test_conch.py257400644editdlrm
test_connection.py292570644editdlrm
test_default.py115880644editdlrm
test_endpoints.py558880644editdlrm
test_filetransfer.py331330644editdlrm
test_forwarding.py21620644editdlrm
test_helper.py200330644editdlrm
test_insults.py321320644editdlrm
test_keys.py625190644editdlrm
test_knownhosts.py494970644editdlrm
test_manhole.py132570644editdlrm
test_manhole_tap.py43510644editdlrm
test_mixin.py10540644editdlrm
test_openssh_compat.py48760644editdlrm
test_recvline.py254320644editdlrm
test_scripts.py17810644editdlrm
test_session.py447930644editdlrm
test_ssh.py329380644editdlrm
test_tap.py50370644editdlrm
test_telnet.py268070644editdlrm
test_text.py40210644editdlrm
test_transport.py1072710644editdlrm
test_unix.py26000644editdlrm
test_userauth.py335550644editdlrm
test_window.py21130644editdlrm
__init__.py140644editdlrm
Edit: /usr/lib/python3/dist-packages/twisted/conch/test/test_forwarding.py (2162B)
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.conch.ssh.forwarding}. """ from twisted.python.reflect import requireModule cryptography = requireModule("cryptography") if cryptography: from twisted.conch.ssh import forwarding from twisted.internet.address import IPv6Address from twisted.internet.test.test_endpoints import deterministicResolvingReactor from twisted.test.proto_helpers import MemoryReactorClock, StringTransport from twisted.trial import unittest class TestSSHConnectForwardingChannel(unittest.TestCase): """ Unit and integration tests for L{SSHConnectForwardingChannel}. """ if not cryptography: skip = "Cannot run without cryptography" def makeTCPConnection(self, reactor): """ Fake that connection was established for first connectTCP request made on C{reactor}. @param reactor: Reactor on which to fake the connection. @type reactor: A reactor. """ factory = reactor.tcpClients[0][2] connector = reactor.connectors[0] protocol = factory.buildProtocol(None) transport = StringTransport(peerAddress=connector.getDestination()) protocol.makeConnection(transport) def test_channelOpenHostnameRequests(self): """ When a hostname is sent as part of forwarding requests, it is resolved using HostnameEndpoint's resolver. """ sut = forwarding.SSHConnectForwardingChannel(hostport=("fwd.example.org", 1234)) # Patch channel and resolver to not touch the network. memoryReactor = MemoryReactorClock() sut._reactor = deterministicResolvingReactor(memoryReactor, ["::1"]) sut.channelOpen(None) self.makeTCPConnection(memoryReactor) self.successResultOf(sut._channelOpenDeferred) # Channel is connected using a forwarding client to the resolved # address of the requested host. self.assertIsInstance(sut.client, forwarding.SSHForwardingClient) self.assertEqual( IPv6Address("TCP", "::1", 1234), sut.client.transport.getPeer() )