%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f�
��^�dZddlmZmZddlmZddlmZddlm	Z	ddl
mZGd�de�Zy	)
z
Tests for L{twisted.tap.ftp}.
�)�credentials�error)�versions)�FilePath)�Options)�TestCasec�8�eZdZdZdZd	d�Zd	d�Zd	d�Zd�Zd�Z	y)
�FTPOptionsTestszJ
    Tests for the command line option parser used for C{twistd ftp}.
    )siamusersthisispasswordNc���|j�|_t|j�}|jdj	|j
��t
�|_y)z/
        Create a file with two users.
        �:N)�mktemp�filenamer�
setContent�join�usernamePasswordr�options)�self�fs  �?/usr/lib/python3/dist-packages/twisted/test/test_ftp_options.py�setUpzFTPOptionsTests.setUpsC�����
��
��T�]�]�#��	���T�Y�Y�t�4�4�5�6��y���c��|jtjdddd�|jj|j
�y)zs
        The C{--password-file} option will emit a warning stating that
        said option is deprecated.
        �Twisted��rN)�callDeprecatedr�Versionr�opt_password_filer)rs r�test_passwordfileDeprecationz,FTPOptionsTests.test_passwordfileDeprecations:��
	
������Y��A�q�1��L�L�*�*��M�M�	
rc���t|jd�}|jjdd|jzg�|j	t|jd�|dz�y)zf
        The C{--auth} command-line option will add a checker to the list of
        checkers
        �credCheckers�--auth�file:rN)�lenr�parseOptionsr�assertEqual)r�numCheckerss  r�test_authAddedzFTPOptionsTests.test_authAdded*sY��
�$�,�,�~�6�7�����!�!�8�W�t�}�}�-D�"E�F�����T�\�\�.�9�:�K�!�O�Lrc����jjdd�jzg��jdd}tj�j
dd�}|j
|�j�fd�d��S)	z�
        The checker created by the C{--auth} command-line option returns a
        L{Deferred} that fails with L{UnauthorizedLogin} when
        presented with credentials that are unknown to that checker.
        r"r#r!���r�fakec�&���jd�S)Nz!Wrong password should raise error)�fail)�ignorers �r�<lambda>z2FTPOptionsTests.test_authFailure.<locals>.<lambda>=s���4�9�9�%H�I�rc�@�|jtj�S�N)�trapr�UnauthorizedLogin)�errs rr/z2FTPOptionsTests.test_authFailure.<locals>.<lambda>>s������!8�!8�9�r)rr%rr�UsernamePasswordr�requestAvatarId�addCallbacks)r�checker�invalids`  r�test_authFailurez FTPOptionsTests.test_authFailure3sy���	
���!�!�8�W�t�}�}�-D�"E�F��,�,�~�.�r�2���.�.�t�/D�/D�Q�/G��P���&�&�w�/�<�<�I�9�
�	
rc�����jjdd�jzg��jdd}tj�j
��|j
��j��fd��S)z�
        The checker created by the C{--auth} command-line option returns a
        L{Deferred} that returns the avatar id when presented with credentials
        that are known to that checker.
        r"r#r!r*c�<���j|�j�Sr1)r&�username)r=�correctrs ��rr/z2FTPOptionsTests.test_authSuccess.<locals>.<lambda>Ks���T�-�-�h��8H�8H�I�r)rr%rrr5rr6�addCallback)rr8r>s` @r�test_authSuccessz FTPOptionsTests.test_authSuccessAso���	
���!�!�8�W�t�}�}�-D�"E�F��,�,�~�.�r�2���.�.��0E�0E�F���&�&�w�/�;�;�I�
�	
r)�returnN)
�__name__�
__module__�__qualname__�__doc__rrrr(r:r@�rrr
r
s)���7��!�	
�M�
�
rr
N)
rE�twisted.credrr�twisted.pythonr�twisted.python.filepathr�twisted.tap.ftpr�twisted.trial.unittestrr
rFrr�<module>rLs'���,�#�,�#�+�=
�h�=
r

Zerion Mini Shell 1.0