HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/twisted/words/test/__pycache__/test_tap.cpython-310.pyc
o

�b|�@s>ddlmZmZddlmZddlmZGdd�dej�ZdS)�)�credentials�error)�unittest)�tapc@s\eZdZdZdZe�dd�Ze�dd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�ZdS)�
WordsTapTestsz7
    Ensures that the twisted.words.tap API works.
    sadmin:admin
joe:foo
sadminsjoesbarcCs4|��|_t|jd�|_|j�|j�|j��dS)z/
        Create a file with two users.
        �wbN)�mktemp�filename�open�file�write�PASSWD_TEXT�flush��self�r�=/usr/lib/python3/dist-packages/twisted/words/test/test_tap.py�setUps
zWordsTapTests.setUpcCs|j��dS)z0
        Close the dummy user database.
        N)r�closerrrr�tearDownszWordsTapTests.tearDowncCs*t��}|�ddg�|�|dd�dS)zM
        Tests that the --hostname parameter gets passed to Options.
        z
--hostname�myhost�hostnameN)r�Options�parseOptions�assertEqual�r�optrrr�
test_hostname!szWordsTapTests.test_hostnamecCs(t��}|�d|jjg�|�|�dS)zI
        Tests the --passwd command for backwards-compatibility.
        z--passwdN�rrrr�name�
_loginTestrrrr�test_passwd)szWordsTapTests.test_passwdcCs,t��}|�dd|jjg�|�|�dS)zD
        Tests that the --auth command generates a checker.
        z--authzfile:Nrrrrr�	test_auth1szWordsTapTests.test_authcsT��t|d�d�|dd}��|��j�tj��fdd�}|��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�rcs��|�jj�dS)N)r�admin�username)r&rrr�
_gotAvatarGsz,WordsTapTests._loginTest.<locals>._gotAvatar)	r�len�
assertFailure�requestAvatarId�joeWrongr�UnauthorizedLoginr%�addCallback)rr�checkerr'rrrr 9s�zWordsTapTests._loginTestN)�__name__�
__module__�__qualname__�__doc__r
r�UsernamePasswordr%r+rrrr!r"r rrrrr	s	rN)	�twisted.credrr�
twisted.trialr�
twisted.wordsr�TestCaserrrrr�<module>s