Current File : //lib/python3/dist-packages/twisted/conch/test/__pycache__/test_forwarding.cpython-312.pyc |
�
Ϫ�f� � � � d Z ddlmZ ed� ZerddlmZ ddlmZ ddlm Z ddl
mZmZ ddl
mZ G d � d
ej � Zy)z,
Tests for L{twisted.conch.ssh.forwarding}.
� )�
requireModule�cryptography)�
forwarding)�IPv6Address)�deterministicResolvingReactor)�MemoryReactorClock�StringTransport)�unittestc �0 � e Zd ZdZesdZdeddfd�Zdd�Zy) �TestSSHConnectForwardingChannelzH
Unit and integration tests for L{SSHConnectForwardingChannel}.
zCannot run without cryptography�reactor�returnNc � � |j d d }|j d }|j d� }t |j � �� }|j |� y)z�
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.
r � N)�peerAddress)�
tcpClients�
connectors�
buildProtocolr �getDestination�makeConnection)�selfr
�factory� connector�protocol� transports �D/usr/lib/python3/dist-packages/twisted/conch/test/test_forwarding.py�makeTCPConnectionz1TestSSHConnectForwardingChannel.makeTCPConnection sZ � � �$�$�Q�'��*���&�&�q�)� ��(�(��.��#� �0H�0H�0J�K� ���� �*� c � � t j d�� }t � }t |dg� |_ |j d� | j
|� | j |j � | j |j t j � | j t ddd� |j j j � � y)z�
When a hostname is sent as part of forwarding requests, it
is resolved using HostnameEndpoint's resolver.
)zfwd.example.org�� )�hostportz::1N�TCPr )r �SSHConnectForwardingChannelr r �_reactor�channelOpenr �successResultOf�_channelOpenDeferred�assertIsInstance�client�SSHForwardingClient�assertEqualr r �getPeer)r �sut�
memoryReactors r � test_channelOpenHostnameRequestsz@TestSSHConnectForwardingChannel.test_channelOpenHostnameRequests+ s� � �
�4�4�>W�X��*�,�
�4�]�U�G�L�����������}�-����S�5�5�6�
���c�j�j�*�*H�*H�I������u�d�+�S�Z�Z�-A�-A�-I�-I�-K�
r )r N) �__name__�
__module__�__qualname__�__doc__r �skipr r r/ � r r r r s* � �� �0��+�);� +�� +�
r r N)r3 �twisted.python.reflectr r �twisted.conch.sshr �twisted.internet.addressr �$twisted.internet.test.test_endpointsr �twisted.internet.testingr r �
twisted.trialr
�TestCaser r5 r r �<module>r= s= ���
1��^�,���,� 0� N� H� "�(
�h�&7�&7� (
r