§
    Ètºf˜
  ã                   óf   — d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ  G d„ de¦  «        Zd	S )
z
Tests for L{twisted.tap.ftp}.
é    )ÚcredentialsÚerror)Úversions)ÚFilePath)ÚOptions)ÚTestCasec                   ó:   — e Zd ZdZdZd
d„Zd
d„Zd
d„Zd„ Zd	„ Z	dS )ÚFTPOptionsTestszJ
    Tests for the command line option parser used for C{twistd ftp}.
    )s   iamusers   thisispasswordÚreturnNc                 óà   — |                       ¦   «         | _        t          | j        ¦  «        }|                     d                     | j        ¦  «        ¦  «         t          ¦   «         | _        dS )z/
        Create a file with two users.
        ó   :N)ÚmktempÚfilenamer   Ú
setContentÚjoinÚusernamePasswordr   Úoptions)ÚselfÚfs     ú\/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/test/test_ftp_options.pyÚsetUpzFTPOptionsTests.setUp   sR   € ð Ÿš™œˆŒÝ�T”]Ñ#Ô#ˆØ	�Š�T—Y’Y˜tÔ4Ñ5Ô5Ñ6Ô6Ð6Ý‘y”yˆŒˆˆó    c                 ó|   — |                       t          j        dddd¦  «        | j        j        | j        ¦  «         dS )zs
        The C{--password-file} option will emit a warning stating that
        said option is deprecated.
        ÚTwistedé   é   r   N)ÚcallDeprecatedr   ÚVersionr   Úopt_password_filer   )r   s    r   Útest_passwordfileDeprecationz,FTPOptionsTests.test_passwordfileDeprecation   sG   € ð
 	×ÒÝÔ˜Y¨¨A¨qÑ1Ô1ØŒLÔ*ØŒMñ	
ô 	
ð 	
ð 	
ð 	
r   c                 óä   — t          | j        d         ¦  «        }| j                             dd| j        z   g¦  «         |                      t          | j        d         ¦  «        |dz   ¦  «         dS )zf
        The C{--auth} command-line option will add a checker to the list of
        checkers
        ÚcredCheckersú--authúfile:r   N)Úlenr   ÚparseOptionsr   ÚassertEqual)r   ÚnumCheckerss     r   Útest_authAddedzFTPOptionsTests.test_authAdded*   si   € õ
 ˜$œ, ~Ô6Ñ7Ô7ˆØŒ×!Ò! 8¨W°t´}Ñ-DÐ"EÑFÔFÐFØ×Ò�˜Tœ\¨.Ô9Ñ:Ô:¸KÈ!¹OÑLÔLÐLÐLÐLr   c                 ó  ‡ — ‰ j                              dd‰ j        z   g¦  «         ‰ j         d         d         }t          j        ‰ j        d         d¦  «        }|                     |¦  «                             ˆ fd„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                 ó.   •— ‰                      d¦  «        S )Nz!Wrong password should raise error)Úfail)Úignorer   s    €r   ú<lambda>z2FTPOptionsTests.test_authFailure.<locals>.<lambda>=   s   ø€ ˜4Ÿ9š9Ð%HÑIÔI€ r   c                 ó@   — |                       t          j        ¦  «        S ©N)Útrapr   ÚUnauthorizedLogin)Úerrs    r   r0   z2FTPOptionsTests.test_authFailure.<locals>.<lambda>>   s   € ˜Ÿš¥Ô!8Ñ9Ô9€ r   )r   r&   r   r   ÚUsernamePasswordr   ÚrequestAvatarIdÚaddCallbacks)r   ÚcheckerÚinvalids   `  r   Útest_authFailurez FTPOptionsTests.test_authFailure3   sŠ   ø€ ð 	Œ×!Ò! 8¨W°t´}Ñ-DÐ"EÑFÔFÐFØ”,˜~Ô.¨rÔ2ˆÝÔ.¨tÔ/DÀQÔ/GÈÑPÔPˆØ×&Ò& wÑ/Ô/×<Ò<ØIÐIÐIÐIØ9Ð9ñ
ô 
ð 	
r   c                 óò   ‡ ‡— ‰ j                              dd‰ j        z   g¦  «         ‰ j         d         d         }t          j        ‰ j        Ž Š|                     ‰¦  «                             ˆˆ fd„¦  «        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        ¦  «        S r2   )r'   Úusername)r>   Úcorrectr   s    €€r   r0   z2FTPOptionsTests.test_authSuccess.<locals>.<lambda>K   s   ø€ ˜T×-Ò-¨h¸Ô8HÑIÔI€ r   )r   r&   r   r   r6   r   r7   ÚaddCallback)r   r9   r?   s   ` @r   Útest_authSuccessz FTPOptionsTests.test_authSuccessA   s~   øø€ ð 	Œ×!Ò! 8¨W°t´}Ñ-DÐ"EÑFÔFÐFØ”,˜~Ô.¨rÔ2ˆÝÔ.°Ô0EÐFˆØ×&Ò& wÑ/Ô/×;Ò;ØIÐIÐIÐIÐIñ
ô 
ð 	
r   )r   N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r    r)   r;   rA   © r   r   r
   r
      s„   € € € € € ðð ð 7Ðð!ð !ð !ð !ð	
ð 	
ð 	
ð 	
ðMð Mð Mð Mð
ð 
ð 
ð
ð 
ð 
ð 
ð 
r   r
   N)rE   Útwisted.credr   r   Útwisted.pythonr   Útwisted.python.filepathr   Útwisted.tap.ftpr   Útwisted.trial.unittestr   r
   rF   r   r   ú<module>rL      s¥   ððð ð ,Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ø #Ð #Ð #Ð #Ð #Ð #Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø #Ð #Ð #Ð #Ð #Ð #Ø +Ð +Ð +Ð +Ð +Ð +ð=
ð =
ð =
ð =
ð =
�hñ =
ô =
ð =
ð =
ð =
r   