§
    Étºfl	  ã                  óx   — d dl m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
j        ¦  «        Zd	S )
é    )Úannotations)ÚcredentialsÚerror)ÚFilePasswordDB)Údefer)Úunittest)Útapc                  óŠ   — e Zd ZdZdZ ej        dd¦  «        Z ej        dd¦  «        Zdd„Z	dd	„Z
dd
„Zdd„Zdd„Zdd„ZdS )ÚWordsTapTestsz7
    Ensures that the twisted.words.tap API works.
    s   admin:admin
joe:foo
s   admins   joes   barÚreturnÚNonec                óÜ   — |                       ¦   «         | _        t          | j        d¦  «        | _        | j                             | j        ¦  «         | j                             ¦   «          dS )z/
        Create a file with two users.
        ÚwbN)ÚmktempÚfilenameÚopenÚfileÚwriteÚPASSWD_TEXTÚflush©Úselfs    úZ/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/words/test/test_tap.pyÚsetUpzWordsTapTests.setUp   sU   € ð Ÿš™œˆŒÝ˜œ¨Ñ-Ô-ˆŒ	ØŒ	�Š˜Ô(Ñ)Ô)Ð)ØŒ	�ŠÑÔÐÐÐó    c                ó8   — | j                              ¦   «          dS )z0
        Close the dummy user database.
        N)r   Úcloser   s    r   ÚtearDownzWordsTapTests.tearDown   s   € ð 	Œ	�ŠÑÔÐÐÐr   c                ó’   — t          j        ¦   «         }|                     ddg¦  «         |                      |d         d¦  «         dS )zM
        Tests that the --hostname parameter gets passed to Options.
        z
--hostnameÚmyhostÚhostnameN)r	   ÚOptionsÚparseOptionsÚassertEqual©r   Úopts     r   Útest_hostnamezWordsTapTests.test_hostname%   sH   € õ Œk‰mŒmˆØ×Ò˜,¨Ð1Ñ2Ô2Ð2Ø×Ò˜˜Zœ¨(Ñ3Ô3Ð3Ð3Ð3r   c                ó˜   — t          j        ¦   «         }|                     d| j        j        g¦  «         |                      |¦  «         dS )zI
        Tests the --passwd command for backwards-compatibility.
        z--passwdN©r	   r"   r#   r   ÚnameÚ
_loginTestr%   s     r   Útest_passwdzWordsTapTests.test_passwd-   sD   € õ Œk‰mŒmˆØ×Ò˜* d¤i¤nÐ5Ñ6Ô6Ð6Ø�Š˜ÑÔÐÐÐr   c                óž   — t          j        ¦   «         }|                     dd| j        j        z   g¦  «         |                      |¦  «         dS )zD
        Tests that the --auth command generates a checker.
        z--authzfile:Nr)   r%   s     r   Ú	test_authzWordsTapTests.test_auth5   sI   € õ Œk‰mŒmˆØ×Ò˜( G¨d¬i¬nÑ$<Ð=Ñ>Ô>Ð>Ø�Š˜ÑÔÐÐÐr   r&   útap.Optionsúdefer.Deferred[None]c                óH  ‡ — ‰                       t          |d         ¦  «        d¦  «         |d         d         }‰                      |                     ‰ j        ¦  «        t
          j        ¦  «         d	ˆ fd„}|                     ‰ j        ¦  «                             |¦  «        S )
zå
        This method executes both positive and negative authentication
        tests against whatever credentials checker has been stored in
        the Options class.

        @param opt: An instance of L{tap.Options}.
        ÚcredCheckersé   r   Úusernameúbytes | tuple[()]r   r   c                óH   •— ‰                      | ‰j        j        ¦  «         d S )N)r$   Úadminr4   )r4   r   s    €r   Ú
_gotAvatarz,WordsTapTests._loginTest.<locals>._gotAvatarK   s$   ø€ Ø×Ò˜X t¤zÔ':Ñ;Ô;Ð;Ð;Ð;r   )r4   r5   r   r   )	r$   ÚlenÚassertFailureÚrequestAvatarIdÚjoeWrongr   ÚUnauthorizedLoginr7   ÚaddCallback)r   r&   Úcheckerr8   s   `   r   r+   zWordsTapTests._loginTest=   s«   ø€ ð 	×Ò�˜S Ô0Ñ1Ô1°1Ñ5Ô5Ð5Ø"% nÔ"5°aÔ"8ˆØ×ÒØ×#Ò# D¤MÑ2Ô2µEÔ4Kñ	
ô 	
ð 	
ð	<ð 	<ð 	<ð 	<ð 	<ð 	<ð ×&Ò& t¤zÑ2Ô2×>Ò>¸zÑJÔJÐJr   N)r   r   )r&   r/   r   r0   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚUsernamePasswordr7   r<   r   r   r'   r,   r.   r+   © r   r   r   r      sË   € € € € € ðð ð ,€KØ(ˆKÔ(¨°8Ñ<Ô<€EØ+ˆ{Ô+¨F°FÑ;Ô;€Hðð ð ð ðð ð ð ð4ð 4ð 4ð 4ðð ð ð ðð ð ð ðKð Kð Kð Kð Kð Kr   r   N)Ú
__future__r   Útwisted.credr   r   Útwisted.cred.checkersr   Útwisted.internetr   Útwisted.trialr   Útwisted.wordsr	   ÚTestCaser   rE   r   r   ú<module>rM      sÄ   ðð #Ð "Ð "Ð "Ð "Ð "à +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø "Ð "Ð "Ð "Ð "Ð "Ø "Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ð Ð ðAKð AKð AKð AKð AK�HÔ%ñ AKô AKð AKð AKð AKr   