%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/conch/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/conch/test/__pycache__/test_telnet.cpython-312.pyc

�

Ϫ�f�h��B�dZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZeej�Gd	�d
��ZGd�dej"�ZGd
�dej"�ZGd�dej(�ZGd�dej"�Zy)z$
Tests for L{twisted.conch.telnet}.
�)�implementer)�verifyObject)�telnet)�defer)�	iterbytes)�
proto_helpers)�unittestc�\�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zy)�TestProtocol�c�f�d|_g|_g|_g|_g|_g|_g|_y)N�)�data�subcmd�calls�enabledLocal�
enabledRemote�
disabledLocal�disabledRemote��selfs �@/usr/lib/python3/dist-packages/twisted/conch/test/test_telnet.py�__init__zTestProtocol.__init__s7����	������
���������� ��rc���ix}|_�j|d<|jj�x}|_dD]}|f�fd�	|t	t
|�<�y)N�)
�EOR�NOP�DM�BRK�IP�AO�AYT�EC�EL�GAc�:���jj|�S�N)r�append)�arg�cmdrs  �r�<lambda>z-TestProtocol.makeConnection.<locals>.<lambda>)s���4�:�:�;L�;L�S�;Q�r)�negotiationMap�neg_TEST_COMMAND�
commandMap�copy�getattrr)r�	transport�dr*s`   r�makeConnectionzTestProtocol.makeConnection#s`���')�)��I�$��*�*��'�
�#,�#7�#7�#<�#<�#>�>��I� �S�	R�C�69�&Q�A�g�f�c�"�#�	Rrc�.�|xj|z
c_yr')r�rrs  r�dataReceivedzTestProtocol.dataReceived+s���	�	�T��	rc��yr'r)r�reasons  r�connectionLostzTestProtocol.connectionLost.s��rc��||_yr')r)r�payloads  rr-zTestProtocol.neg_TEST_COMMAND1s	����rc�X�||jvr|jj|�yy�NTF)�localEnableablerr(�r�options  r�enableLocalzTestProtocol.enableLocal4s*���T�)�)�)����$�$�V�,��rc�:�|jj|�yr')rr(r?s  r�disableLocalzTestProtocol.disableLocal:s�����!�!�&�)rc�X�||jvr|jj|�yyr=)�remoteEnableablerr(r?s  r�enableRemotezTestProtocol.enableRemote=s*���T�*�*�*����%�%�f�-��rc�:�|jj|�yr')rr(r?s  r�
disableRemotezTestProtocol.disableRemoteCs�����"�"�6�*rc��yr'rrs r�connectionMadezTestProtocol.connectionMadeF���rc��yr'r)r�command�arguments   r�unhandledCommandzTestProtocol.unhandledCommandJrKrc��yr'r�rrMrs   r�unhandledSubnegotiationz$TestProtocol.unhandledSubnegotiationNrKrN)�__name__�
__module__�__qualname__r>rErr3r6r9r-rArCrFrHrJrOrRrrrrrsJ���O���!�R��
���*��+�
�
�
rrc��eZdZd�Zy)�InterfacesTestsc�`�tj�}ttj|�y)zO
        L{telnet.TelnetProtocol} implements L{telnet.ITelnetProtocol}
        N)r�TelnetProtocolr�ITelnetProtocol)r�ps  r�test_interfacezInterfacesTests.test_interfaceTs"��
�!�!�#���V�+�+�Q�/rN)rSrTrUr\rrrrWrWSs��0rrWc��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zggggfd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(y')(�TelnetTransportTestsz.
    Tests for L{telnet.TelnetTransport}.
    c��tjt�|_t	j
�|_|jj|j�yr')r�TelnetTransportrr[r�StringTransport�tr3rs r�setUpzTelnetTransportTests.setUpas:���'�'��5����.�.�0��������d�f�f�%rc���|jj}gd�}|D]}|jj|��|j|jdj|��y)N)shere are some bytes la la lassome more arrive hereslots of bytes to play withsla la lasta de dasdumr)r[�protocolr6�assertEqualr�join�r�h�L�bs    r�testRegularBytesz%TelnetTransportTests.testRegularBytesfsY��
�F�F�O�O��
���	#�A��F�F����"�	#�	
���������!��-rc��|jj}gd�}|D]}|jj|��|j|j|ddddz|dddzdz|dddzdz|dddzdz�y)	N)shere is the first line
shere is the second line
shere is the third line
shere is the last line
r����
��
��)r[rer6rfrrhs    r�testNewlineHandlingz(TelnetTransportTests.testNewlineHandlingys���
�F�F�O�O��
���	#�A��F�F����"�	#�	
���
�F�F�
�a�D��"�I��
���d�3�B�i�
��
���d�3�B�i�	
�
�
���d�3�B�i�

��
�
	
rc���|jj}gd�}|D]}|jj|��|j|jdj|�j
dd��y)N)s*here are some bytes�� with an embedded IACs&and here is a test of a border escape�s� did you get that IAC?rs����)r[rer6rfrrg�replacerhs    r�
testIACEscapez"TelnetTransportTests.testIACEscape�sf��
�F�F�O�O��
���	#�A��F�F����"�	#�	
���������!��!4�!4�[�'�!J�Krc�z�|jj}tjt	t|�z}dd|zdzg}|D]}|jj|��|j
|j|g�|j
|jdj|�j|d��y)NsHere's some bytes, tra la lasBut ono!s
 an interruptr)r[rer�IACr0r6rfrrrgrw)r�cmdNamerir*rjrks      r�_simpleCommandTestz'TelnetTransportTests._simpleCommandTest�s���
�F�F�O�O���j�j�7�6�7�3�3��
,�k�C�.?�BR�.R�S���	#�A��F�F����"�	#�	
������7�)�,����������!��!4�!4�S�#�!>�?rc�&�|jd�y)Nr �r|rs r�
testInterruptz"TelnetTransportTests.testInterrupt��������%rc�&�|jd�y)Nrr~rs r�testEndOfRecordz$TelnetTransportTests.testEndOfRecord��������&rc�&�|jd�y)Nrr~rs r�testNoOperationz$TelnetTransportTests.testNoOperation�r�rc�&�|jd�y)Nrr~rs r�testDataMarkz!TelnetTransportTests.testDataMark�r�rc�&�|jd�y)Nrr~rs r�	testBreakzTelnetTransportTests.testBreak�r�rc�&�|jd�y)Nr!r~rs r�testAbortOutputz$TelnetTransportTests.testAbortOutput�r�rc�&�|jd�y)Nr"r~rs r�testAreYouTherez$TelnetTransportTests.testAreYouThere�r�rc�&�|jd�y)Nr#r~rs r�testEraseCharacterz'TelnetTransportTests.testEraseCharacter�r�rc�&�|jd�y)Nr$r~rs r�
testEraseLinez"TelnetTransportTests.testEraseLine�r�rc�&�|jd�y)Nr%r~rs r�testGoAheadz TelnetTransportTests.testGoAhead�r�rc���|jj}tjtjzdztjztj
z}d|zdg}|D]}|jj
|��|j|jdj|�j|d��|j|jttd���y)Nshello worldsThese are some bytes but soonsthere will be some morershello world)r[rerrz�SB�SEr6rfrrgrwr�listr�rrir*rjrks     r�testSubnegotiationz'TelnetTransportTests.testSubnegotiation�s���
�F�F�O�O���j�j�6�9�9�$�'9�9�F�J�J�F����R��
-��
3�5O�P���	#�A��F�F����"�	#�	
���������!��!4�!4�S�#�!>�?�������4�	�.�(A�#B�Crc��|jj}tjtjzdztj
ztjztj
z}d|zdzdg}|D]}|jj
|��|j|jdj|�j|d��|j|jtj
g�y)NrsSome bytes are heresand herer)r[rerrzr�r�r6rfrrgrwrr�s     r� testSubnegotiationWithEmbeddedSEz5TelnetTransportTests.testSubnegotiationWithEmbeddedSE�s���
�F�F�O�O���j�j�6�9�9�$�w�.����:�V�Z�Z�G�&�)�)�S��
#�c�
)�K�
7��E���	#�A��F�F����"�	#�	
���������!��!4�!4�S�#�!>�?�������F�I�I�;�/rc
��tjtjzdztjzdztjztjz}t	t|��D]�}t
�x}|j_|j|j�|d|||d}}d|z|dzg}|D]}|jj|��|j|jdj|�j|d��|j|jtjgt!t#d��z���y)Nrshellos
first parts	last partr)rrzr�r��range�lenrr[rer3r6rfrrgrwrr�r)rr*�iri�arkrjrs        r�testBoundarySubnegotiationz/TelnetTransportTests.testBoundarySubnegotiation�s5��

�J�J��i�i�
��
��i�i�
��	
�
�j�j�
��i�i�

�	��s�3�x��	P�A�".�.�0�A�����
���T�V�V�$��r��7�C���G�q�A���"�A��$4�5�A��
*�����#�#�D�)�
*�
���Q�V�V�S�X�X�a�[�%8�%8��c�%B�C����Q�X�X��	�	�{�T�)�H�:M�5N�'N�O�	Prc���|j|j|�|j|j|�|j|j|�|j|j|�yr')rfrrrr)r�o�eL�eR�dL�dRs      r�_enabledHelperz#TelnetTransportTests._enabledHelper
sT���������,�������"�-�������"�-�����)�)�2�.rc���tjtjzdz}d|zdz}|jj	|�|j|jjj|j|d��|j|jj�tjtjzdz�|j|jj�y�Nrssurrounding bytessto spice things upr)
rrz�WILLr[r6rfrerrwrb�value�DONTr��rr*rs   r�testRefuseWillz#TelnetTransportTests.testRefuseWills����j�j�6�;�;�&��0��#�c�)�,A�A�������D�!���������-�-�t�|�|�C��/E�F�������������f�k�k�)A�G�)K�L����D�F�F�O�O�,rc���tjtjzdz}d|zdz}|jj	|�|j|jjj|j|d��|j|jj�tjtjzdz�|j|jj�yr�)
rrz�DOr[r6rfrerrwrbr��WONTr�r�s   r�testRefuseDoz!TelnetTransportTests.testRefuseDos����j�j�6�9�9�$�w�.��#�c�)�,A�A�������D�!���������-�-�t�|�|�C��/E�F�������������f�k�k�)A�G�)K�L����D�F�F�O�O�,rc��tjtjzdz}d|zdz}|jj}d|_|jj
|�|j|jj�tjtjzdz�|j|dg��y)N��paddingstrailer)r�)r�)rrzr�r[rer>r6rfrbr�r�r��rr*rris    r�testAcceptDoz!TelnetTransportTests.testAcceptDo&s����j�j�6�9�9�$�w�.���C��*�,���F�F�O�O��&��������D�!�������������f�k�k�)A�G�)K�L����A�7�)��,rc��tjtjzdz}d|zdz}|jj}d|_|jj
|�|j|jj�tjtjzdz�|j|dg��y)N��sheaderr�)r��r�)rrzr�r[rerEr6rfrbr�r�r�r�s    r�testAcceptWillz#TelnetTransportTests.testAcceptWill3s����j�j�6�;�;�&��0���3���+���F�F�O�O��'��������D�!�������������f�i�i�)?�'�)I�J����A�7�)��,rc��tjtjzdz}|jj	d�}d|j
_d|z}|jj|�|j|jjj|j|d��|j|jj�tjtjzdz�|j|j
jd�|j|jjdg��y)N�)�yess
fiddle deer�no�r�)rrzr�r[�getOptionState�him�stater6rfrerrwrbr�r�r��rr*�srs    r�testAcceptWontz#TelnetTransportTests.testAcceptWont?s����j�j�6�;�;�&��0��

�F�F�!�!�'�*��������s�"�������D�!���������-�-�t�|�|�C��/E�F�������������f�k�k�)A�G�)K�L���������d�+����D�F�F�O�O��	��:rc��tjtjzdz}|jj	d�}d|j
_d|z}|jj|�|j|jjj|j|d��|j|jj�tjtjzdz�|j|j
jd�|j|jjdg��y)Nr�r�sfiddle dum rr�)r�)rrzr�r[r��usr�r6rfrerrwrbr�r�r�r�s    r�testAcceptDontz#TelnetTransportTests.testAcceptDontSs����j�j�6�;�;�&��0��

�F�F�!�!�'�*������
���#�������D�!���������-�-�t�|�|�C��/E�F�������������f�k�k�)A�G�)K�L���������T�*����D�F�F�O�O��	��:rc��tjtjzdz}d|zdz}|jj	|�|j|jjj|j|d��|j|jj�d�|j|jj�y�N�G�
dum de dum�	tra la lar)rrzr�r[r6rfrerrwrbr�r�r�s   r�testIgnoreWontz#TelnetTransportTests.testIgnoreWontgs����j�j�6�;�;�&��0���s�"�\�1�������D�!���������-�-�t�|�|�C��/E�F�����������-����D�F�F�O�O�,rc��tjtjzdz}d|zdz}|jj	|�|j|jjj|j|d��|j|jj�d�|j|jj�yr�)rrzr�r[r6rfrerrwrbr�r�r�s   r�testIgnoreDontz#TelnetTransportTests.testIgnoreDontss����j�j�6�;�;�&��0���s�"�\�1�������D�!���������-�-�t�|�|�C��/E�F�����������-����D�F�F�O�O�,rc��tjtjzdz}|jj	d�}d|j
_d|zdz}|jj|�|j|jjj|j|d��|j|jj�d�|j|jj�y�N�Vr�r�r�r)rrzr�r[r�r�r�r6rfrerrwrbr�r�r�s    r�testIgnoreWillz#TelnetTransportTests.testIgnoreWill�s����j�j�6�;�;�&��0��

�F�F�!�!�'�*��������c�!�M�1�������D�!���������-�-�t�|�|�C��/E�F�����������-����D�F�F�O�O�,rc��tjtjzdz}|jj	d�}d|j
_d|zdz}|jj|�|j|jjj|j|d��|j|jj�d�|j|jj�yr�)rrzr�r[r�r�r�r6rfrerrwrbr�r�r�s    r�testIgnoreDoz!TelnetTransportTests.testIgnoreDo�s����j�j�6�9�9�$�w�.��

�F�F�!�!�'�*������
��c�!�M�1�������D�!���������-�-�t�|�|�C��/E�F�����������-����D�F�F�O�O�,rc������jjd�}�jj�d�_�j	�j
j
�tjtjzdz��jjtjtjzdz�|j�jd�|j��fd��|S)N�B�r�Tc�,���j�dg��S)Nr�r�)r�)�_rirs ��rr+z@TelnetTransportTests.testAcceptedEnableRequest.<locals>.<lambda>�s���� 3� 3�A�7�)� 3� D�r)
r[�dorerErfrbr�rrzr�r6r��addCallback)rr2ris` @r�testAcceptedEnableRequestz.TelnetTransportTests.testAcceptedEnableRequest�s����

�F�F�I�I�g����F�F�O�O��'���������������f�i�i�)?�'�)I�J������F�J�J����4�w�>�?�	�
�
�d�&�&��-�	�
�
�D�E��rc�|���d�jj_�jjd�}�j	�j
j
�tjtjzdz��jjd���j	�jjd��j	�jjd��j�jj��j!�jj��jj#tjtj$zdz��j'|tj(�}|j+�fd��|j+��fd��|S)z�
        If the peer refuses to enable an option we request it to enable, the
        L{Deferred} returned by L{TelnetProtocol.do} fires with an
        L{OptionRefused} L{Failure}.
        r�r�r�c�N���j�jj�Sr'�r�r[re��ignoredrs �rr+z@TelnetTransportTests.test_refusedEnableRequest.<locals>.<lambda>�����d�&9�&9�$�&�&�/�/�&J�rc�N���j�jj�Sr')�assertFalser��negotiating�r�r�rs ��rr+z@TelnetTransportTests.test_refusedEnableRequest.<locals>.<lambda>�s���d�&6�&6�q�u�u�7H�7H�&I�r)r[rerEr�rfrbr�rrzr�r�r�r�r��
assertTruer�r�r6r��
assertFailure�
OptionRefusedr��rr2r�s` @r�test_refusedEnableRequestz.TelnetTransportTests.test_refusedEnableRequest�s ���,6������(��F�F�I�I�g���������������f�i�i�)?�'�)I�J��F�F�!�!�'�*����������d�+���������T�*�������)�)�*�������)�)�*������F�J�J����4�w�>�?����q�&�"6�"6�7��	�
�
�J�K�	�
�
�I�J��rc�|���d�jj_�jjd�}�j	�j
j
�tjtjzdz��jjd���j	�jjd��j	�jjd��j�jj��j!�jj��jj#tjtj$zdz��j'|tj(�}|j+�fd��|j+��fd��|S)z�
        If the peer refuses to allow us to enable an option, the L{Deferred}
        returned by L{TelnetProtocol.will} fires with an L{OptionRefused}
        L{Failure}.
        r�r�r�c�N���j�jj�Sr'r�r�s �rr+z>TelnetTransportTests.test_refusedEnableOffer.<locals>.<lambda>�r�rc�N���j�jj�Sr')r�r�r�r�s ��rr+z>TelnetTransportTests.test_refusedEnableOffer.<locals>.<lambda>�s���d�&6�&6�q�t�t�7G�7G�&H�r)r[rer>�willrfrbr�rrzr�r�r�r�r�r�r�r�r6r�r�r�r�r�s` @r�test_refusedEnableOfferz,TelnetTransportTests.test_refusedEnableOffer�s ���+5������'��F�F�K�K�� ��������������f�k�k�)A�G�)K�L��F�F�!�!�'�*����������d�+���������T�*�������*�*�+�������(�(�)������F�J�J����4�w�>�?����q�&�"6�"6�7��	�
�
�J�K�	�
�
�H�I��rc����jjd�}d|j_�jj	d�}�j�jj�tjtjzdz��jjtjtjzdz�|j�j
d�|j�fd��|S)Nr�r�Tc�T���j�jjdg��S)Nr�r�r��r�rs �rr+zATelnetTransportTests.testAcceptedDisableRequest.<locals>.<lambda>�s!���� 3� 3�D�F�F�O�O��	� 3� R�r)r[r�r�r��dontrfrbr�rrzr�r6r�r��rr�r2s`  r�testAcceptedDisableRequestz/TelnetTransportTests.testAcceptedDisableRequest�s����

�F�F�!�!�'�*��������F�F�K�K�� ��������������f�k�k�)A�G�)K�L������F�J�J����4�w�>�?�	�
�
�d�&�&��-�	�
�
�R�S��rc����jjd�}d|j_�jj	d��fd�}�fd�}�fd�}|d�}|j|�|j|�|S)N�$r�c�z���jjd�}�j|tj�S�Nr�)r[r�r�r�AlreadyNegotiating��xr2rs  �r�_dozITelnetTransportTests.testNegotiationBlocksFurtherNegotiation.<locals>._do
s.������	�	�'�"�A��%�%�a��)B�)B�C�Crc�z���jjd�}�j|tj�Sr�)r[r�r�rr�rs  �r�_dontzKTelnetTransportTests.testNegotiationBlocksFurtherNegotiation.<locals>._donts.��������G�$�A��%�%�a��)B�)B�C�Crc����jjtjtjzdz��j�jjdg��d�jj_�jjd�}�jjtjtjzdz�|j�jd�|j�fd��|S)Nr�r�)r�Tc�X���j�jjdgdg��S)Nr�)r�r�r�r�s �rr+z^TelnetTransportTests.testNegotiationBlocksFurtherNegotiation.<locals>._final.<locals>.<lambda>s*���$�-�-��F�F�O�O��	�w�i�.��r)r[r6rrzr�r�rerEr�r�r�rfrs  �r�_finalzLTelnetTransportTests.testNegotiationBlocksFurtherNegotiation.<locals>._finals�����F�F����
�
�V�[�[� 8�7� B�C���������W�I��>�/9�D�F�F�O�O�,����	�	�'�"�A��F�F����
�
�V�[�[� 8�7� B�C�
�M�M�$�*�*�D�1�
�M�M��
�
�Hr)r[r�r�r�r�r�)rr�rrrr2s`     r�'testNegotiationBlocksFurtherNegotiationz<TelnetTransportTests.testNegotiationBlocksFurtherNegotiationsm���
�F�F�!�!�'�*������������G��	D�	D�	� 
��I��	�
�
�e��	�
�
�f���rc�x�|jjd�}|j|tj�S)N��)r[r�r�r�AlreadyDisabled)rr2s  r�#testSuperfluousDisableRequestRaisesz8TelnetTransportTests.testSuperfluousDisableRequestRaises's-���F�F�K�K�� ���!�!�!�V�%;�%;�<�<rc���|jjd�}d|j_|jj	d�}|j|tj�S)Nr
r�)r[r�r�r�r�r�r�AlreadyEnabledr�s   r�"testSuperfluousEnableRequestRaisesz7TelnetTransportTests.testSuperfluousEnableRequestRaises,sL���F�F�!�!�'�*��������F�F�I�I�g����!�!�!�V�%:�%:�;�;rc��|jjd�}|jjd�}|jjd�}Gd�dt�}|jj|d��|j	||�}|j	||�}|j	||�}tj|||g�S)Nr�#�4c��eZdZy)�LTelnetTransportTests.testLostConnectionFailsDeferreds.<locals>.TestExceptionN)rSrTrUrrr�
TestExceptionr8s��rrzTotal failure!)r[r��	Exceptionr9r�r�
gatherResults)r�d1�d2�d3rs     r� testLostConnectionFailsDeferredsz5TelnetTransportTests.testLostConnectionFailsDeferreds3s���
�V�V�Y�Y�w�
��
�V�V�Y�Y�w�
��
�V�V�Y�Y�w�
��	�I�	�	
�����m�,<�=�>�
�
�
��M�
2��
�
�
��M�
2��
�
�
��M�
2���"�"�B��B�<�0�0rN))rSrTrU�__doc__rcrlrtrxr|rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrr^r^\s����&�
.�&
�6L�"
@�&�'�'�&�'�&�'�&�&�&�D�
0�P�6$&�"���/�	-�	-�-�
-�;�(;�(
-�-�-�&-�&�$�8�8�$#�J=�
<�
1rr^c�(�eZdZdZd�Zd�Zd�Zd�Zy)�
TestTelnetzP
    A trivial extension of the telnet protocol class useful to unit tests.
    c�P�tjj|�g|_yr')r�Telnetr�eventsrs rrzTestTelnet.__init__Hs���
�
���t�$���rc�>�|jjd|f�y)z:
        Record the given data in C{self.events}.
        �bytesN�r!r(r5s  r�applicationDataReceivedz"TestTelnet.applicationDataReceivedLs��	
�����G�T�?�+rc�@�|jjd||f�y)z=
        Record the given command in C{self.events}.
        rMNr$rQs   rrOzTestTelnet.unhandledCommandRs��	
�����I�w��5�6rc�@�|jjd||f�y)zL
        Record the given subnegotiation command in C{self.events}.
        �	negotiateNr$rQs   rrRz"TestTelnet.unhandledSubnegotiationXs��	
�����K��$�7�8rN)rSrTrUrrr%rOrRrrrrrCs����,�7�9rrc�p�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�TelnetTestsz�
    Tests for L{telnet.Telnet}.

    L{telnet.Telnet} implements the TELNET protocol (RFC 854), including option
    and suboption negotiation, and option state tracking.
    c�"�t�|_y)zM
        Create an unconnected L{telnet.Telnet} to be used by tests.
        N)rrers rrczTelnetTests.setUpgs
��#���
rc�X�|j|jjd��y)z�
        L{telnet.Telnet.enableLocal} should reject all options, since
        L{telnet.Telnet} does not know how to implement any options.
        �N)r�rerArs r�test_enableLocalzTelnetTests.test_enableLocalms!��
	
������2�2�5�9�:rc�X�|j|jjd��y)z�
        L{telnet.Telnet.enableRemote} should reject all options, since
        L{telnet.Telnet} does not know how to implement any options.
        r-N)r�rerFrs r�test_enableRemotezTelnetTests.test_enableRemotets!��
	
������3�3�E�:�;rc�Z�|jt|jjd�y)a	
        It is an error for L{telnet.Telnet.disableLocal} to be called, since
        L{telnet.Telnet.enableLocal} will never allow any options to be enabled
        locally.  If a subclass overrides enableLocal, it must also override
        disableLocal.
        r-N)�assertRaises�NotImplementedErrorrerCrs r�test_disableLocalzTelnetTests.test_disableLocal{s!��	
���-�t�}�}�/I�/I�5�Qrc�Z�|jt|jjd�y)a
        It is an error for L{telnet.Telnet.disableRemote} to be called, since
        L{telnet.Telnet.enableRemote} will never allow any options to be
        enabled remotely.  If a subclass overrides enableRemote, it must also
        override disableRemote.
        r-N)r2r3rerHrs r�test_disableRemotezTelnetTests.test_disableRemote�s!��	
���-�t�}�}�/J�/J�E�Rrc���tj�}|jj|�|jj	dd�|j|j
�d�y)z�
        L{telnet.Telnet.requestNegotiation} formats the feature byte and the
        payload bytes into the subnegotiation format and sends them.

        See RFC 855.
        �ss����N�rrarer3�requestNegotiationrfr��rr1s  r�test_requestNegotiationz#TelnetTests.test_requestNegotiation�sS��"�1�1�3�	��
�
�$�$�Y�/��
�
�(�(��+�>�����O�O��+�	
rc���tj�}|jj|�|jj	dd�|j|j
�d�y)z�
        If the payload for a subnegotiation includes I{IAC}, it is escaped by
        L{telnet.Telnet.requestNegotiation} with another I{IAC}.

        See RFC 855.
        r8rvs������Nr9r;s  r�!test_requestNegotiationEscapesIACz-TelnetTests.test_requestNegotiationEscapesIAC�sP��"�1�1�3�	��
�
�$�$�Y�/��
�
�(�(��'�:�������*�,K�Lrc��gx}|j_|jj|�|j|t	|��y)z
        Pass the given bytes to the protocol's C{dataReceived} method and
        assert that the given events occur.
        N)rer!r6rfr�)rr�expected�receiveds    r�_deliverzTelnetTests._deliver�s;��
+-�,��4�=�=�'��
�
�"�"�4�(�����4��>�2rc�(�|jdd�y)zc
        One application-data byte in the default state gets delivered right
        away.
        �a)r#rDN�rBrs r�test_oneApplicationDataBytez'TelnetTests.test_oneApplicationDataByte�s��
	
�
�
�d�O�,rc�(�|jdd�y)za
        Two application-data bytes in the default state get delivered
        together.
        �bc)r#rHNrErs r�test_twoApplicationDataBytesz(TelnetTests.test_twoApplicationDataBytes�s��
	
�
�
�e�-�.rc�J�|jdtjzd�y)z~
        Three application-data bytes followed by a control byte get
        delivered, but the control byte doesn't.
        �def)r#rKN�rBrrzrs r�test_threeApplicationDataBytesz*TelnetTests.test_threeApplicationDataBytes�s��
	
�
�
�f�v�z�z�)�+<�=rc��|jtj�|jtjdzdtjdzf�y)zy
        IAC in the escaped state gets delivered and so does another
        application-data byte following it.
        �gr#NrLrs r�test_escapedControlzTelnetTests.test_escapedControl�s9��
	
�
�
�f�j�j�!��
�
�f�j�j�4�'�'�6�:�:��3D�)E�Frc��|jd�|jdd�|jdd�|jd�|jdd�|jdd�|jd�|jdd	�|jd
d	�|jd�|jtjtjzdzddtjzdzf�y
)a�
        A carriage return only puts the protocol into the newline state.  A
        linefeed in the newline state causes just the newline to be
        delivered.  A nul in the newline state causes a carriage return to
        be delivered.  An IAC in the newline state causes a carriage return
        to be delivered and puts the protocol into the escaped state.
        Anything else causes a carriage return and that thing to be
        delivered.
        rqro)r#ros
r-)r#rqs
rD)r#�
arR�xr#NrLrs r�test_carriageReturnzTelnetTests.test_carriageReturn�s���	
�
�
�e���
�
�e�-�.��
�
�g�/�0��
�
�e���
�
�e�-�.��
�
�g�/�0��
�
�e���
�
�d�-�.��
�
�f�/�0��
�
�e���
�
��J�J����#�d�*�W�e�f�j�j�6H�4�6O�,P�	
rc��|jdtjztjzddtjdf�y)zt
        Application bytes received before a command are delivered before the
        command is processed.
        rS)r#rSrMN)rBrrzrrs r�'test_applicationDataBeforeSimpleCommandz3TelnetTests.test_applicationDataBeforeSimpleCommand�s6��
	
�
�
��6�:�:���
�
�*��
��
�
�D�)�	
rc��i|j_|jdtjztj
zdzddtj
df�y)z~
        Application bytes received before a WILL/WONT/DO/DONT are delivered
        before the command is processed.
        �yr-)r#rXrMN)rer.rBrrzr�rs r�!test_applicationDataBeforeCommandz-TelnetTests.test_applicationDataBeforeCommand�sG��
$&��
�
� ��
�
��6�:�:�����+�g�5��
����W�-�	
rc��|jdtjztjzdztjztjzddddgf�y)z�
        Application bytes received before a subnegotiation command are
        delivered before the negotiation is processed.
        �zsQx)r#r[r(�QrSN)rBrrzr�r�rs r�(test_applicationDataBeforeSubnegotiationz4TelnetTests.test_applicationDataBeforeSubnegotiationsK��
	
�
�
��6�:�:���	�	�)�E�1�F�J�J�>����J��
�$���'�	
rN)rSrTrUrrcr.r0r4r6r<r>rBrFrIrMrPrTrVrYr]rrrr*r*_s[���%�;�<�R�S�
� 
M�3�-�/�>�G�
�6	
�

�	
rr*N)r�zope.interfacer�zope.interface.verifyr�
twisted.conchr�twisted.internetr�twisted.python.compatr�twisted.testr�
twisted.trialr	rZr�TestCaserWr^r rr*rrr�<module>rfs���
�
'�.� �"�+�&�"�
�V�
#�
#�$�;
�;
�%�;
�|0�h�'�'�0�d1�8�,�,�d1�N9����9�8k
�(�#�#�k
r

Zerion Mini Shell 1.0