%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f�d���dZddlZddlmZddlmZmZddlmZddl	m
Z
ddlmZddl
mZmZmZmZdd	lmZmZmZdd
lmZddlmZddlmZdd
lmZddlmZed�Z ed�Z!ed�Z"d�Z#Gd�de�Z$Gd�de�Z%Gd�de�Z&Gd�de�Z'ee!d�ee d�ee"d�Gd�de����Z(ee d �Gd!�d"e��Z)Gd#�d$e�Z*ee!d�eed%�d&�Gd'�d(e���Z+Gd)�d*ejXejZ�Z.Gd+�d,e�Z/Gd-�d.ejXejZ�Z0Gd/�d0ejXejZ�Z1Gd1�d2ejXejZ�Z2Gd3�d4ejXejZ�Z3Gd5�d6e�Z4y)7z
L{twisted.cred.strcred}.
�N)�StringIO)�Sequence�Type)�skipIf)�	Interface)�plugin)�checkers�credentials�error�strcred)�cred_anonymous�	cred_file�	cred_unix)�usage)�UserDatabase)�FilePath)�
requireModule)�TestCase�crypt�pwd�spwdc���d}|tj�D�cgc]}|j��c}vr4|dz
}|tj�D�cgc]}|j��c}vr�4|Scc}wcc}w)zC
    Helper method to produce an auth type that doesn't exist.
    �ThisPluginDoesNotExist�_)r�findCheckerFactories�authType)�invalidAuthType�factorys  �@/usr/lib/python3/dist-packages/twisted/cred/test/test_strcred.py�getInvalidAuthTyper s}��/�O�
�(/�(D�(D�(F��$������	�3����(/�(D�(D�(F��$���������	��s�A'�
A,c��eZdZd�Zd�Zy)�PublicAPITestsc���t�}|jtjtj|�|jtjtj
|�y)z9
        The description string cannot be empty.
        N�r �assertRaisesr�InvalidAuthType�makeChecker�findCheckerFactory��self�iats  r�test_emptyDescriptionz$PublicAPITests.test_emptyDescription+�H��!�"�����'�1�1�7�3F�3F��L����'�1�1�7�3M�3M�s�S�c���t�}|jtjtj|�|jtjtj
|�y)z@
        An unrecognized auth type raises an exception.
        Nr$r)s  r�test_invalidAuthTypez#PublicAPITests.test_invalidAuthType3r-r.N)�__name__�
__module__�__qualname__r,r0�r.rr"r"*s��T�Tr.r"c��eZdZd�Zd�Zy)�StrcredFunctionsTestsc��ttj��}tjtj
�D]}|j
||��y)zP
        L{strcred.findCheckerFactories} returns all available plugins.
        N)�listrrr�
getPlugins�ICheckerFactory�assertIn)r*�availablePlugins�plgs   r�test_findCheckerFactoriesz/StrcredFunctionsTests.test_findCheckerFactories=sG�� �� <� <� >�?���$�$�W�%<�%<�=�	1�C��M�M�#�/�0�	1r.c�j�|jtjd�tj�y)z{
        L{strcred.findCheckerFactory} returns the first plugin
        available for a given authentication type.
        �fileN)�assertIdenticalrr(r�theFileCheckerFactory�r*s r�test_findCheckerFactoryz-StrcredFunctionsTests.test_findCheckerFactoryEs(��
	
����&�&�v�.�	�0O�0O�	
r.N)r1r2r3r>rDr4r.rr6r6<s��1�
r.r6c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�MemoryCheckerTestsc��tjdd�|_tjdd�|_tjdd�|_tjdd�|_t
jd�|_y)	N�admin�asdf�alice�foo�foobar�x�yzzmemory:admin:asdf:alice:foo)	r
�UsernamePasswordrHrJ�badPass�badUserrr'�checkerrCs r�setUpzMemoryCheckerTests.setUpPse�� �1�1�'�6�B��
� �1�1�'�5�A��
�"�3�3�G�X�F���"�3�3�C��>����*�*�+H�I��r.c���|jtjj|j��|jtj|jj�y�z�
        Verifies that strcred.makeChecker('memory') returns an object
        that implements the L{ICredentialsChecker} interface.
        N�	�
assertTruer	�ICredentialsChecker�
providedByrRr;r
�IUsernamePassword�credentialInterfacesrCs r�test_isCheckerz!MemoryCheckerTests.test_isCheckerW�C��
	
����4�4�?�?����M�N��
�
�k�3�3�T�\�\�5V�5V�Wr.c�b�|jtjtjd�y)z�
        An argument string which does not contain user:pass pairs
        (i.e., an odd number of ':' characters) raises an exception.
        zmemory:a:b:cN)r%r�InvalidAuthArgumentStringr'rCs r�test_badFormatArgStringz*MemoryCheckerTests.test_badFormatArgString_s%��
	
����-�-�w�/B�/B�N�	
r.c�v���fd�}�jj�j�j|�S)�;
        The checker works with valid credentials.
        c�R���j|�jj�y�N��assertEqualrH�username�rgr*s �r�
_gotAvatarzAMemoryCheckerTests.test_memoryCheckerSucceeds.<locals>._gotAvatarm�������X�t�z�z�':�':�;r.�rR�requestAvatarIdrH�addCallback�r*ris` r�test_memoryCheckerSucceedsz-MemoryCheckerTests.test_memoryCheckerSucceedsh�.���
	<��|�|�+�+�D�J�J�7�C�C�J�O�Or.c��|j|jj|j�tj
�S�z=
        The checker fails with an invalid username.
        ��
assertFailurerRrlrQr�UnauthorizedLoginrCs r�test_memoryCheckerFailsUsernamez2MemoryCheckerTests.test_memoryCheckerFailsUsernamer�5���!�!��L�L�(�(����6��8O�8O�
�	
r.c��|j|jj|j�tj
�S�z=
        The checker fails with an invalid password.
        �rtrRrlrPrrurCs r�test_memoryCheckerFailsPasswordz2MemoryCheckerTests.test_memoryCheckerFailsPasswordzrwr.N)	r1r2r3rSr\r`rorvr{r4r.rrFrFOs#��J�X�
�P�
�
r.rFc��eZdZd�Zd�Zy)�AnonymousCheckerTestsc���tjd�}|jtjj|��|j
tj|j�y)z�
        Verifies that strcred.makeChecker('anonymous') returns an object
        that implements the L{ICredentialsChecker} interface.
        �	anonymousN)
rr'rWr	rXrYr;r
�
IAnonymousr[)r*rRs  rr\z$AnonymousCheckerTests.test_isChecker�sK��
�%�%�k�2������4�4�?�?��H�I��
�
�k�,�,�g�.J�.J�Kr.c���tjd�}|jtj��}�fd�}|j|�S)z?
        We can log in anonymously using this checker.
        rc�F���jtj|�yrd)rAr	�	ANONYMOUS)�avatarr*s �rrizEAnonymousCheckerTests.testAnonymousAccessSucceeds.<locals>._gotAvatar�s���� � ��!3�!3�V�<r.)rr'rlr
�	Anonymousrm)r*rR�requestris`   r�testAnonymousAccessSucceedsz1AnonymousCheckerTests.testAnonymousAccessSucceeds�sF����%�%�k�2���)�)�+�*?�*?�*A�B��	=��"�"�:�.�.r.N)r1r2r3r\r�r4r.rr}r}�s
��L�
/r.r}z"Required module not available: pwdz$Required module not available: cryptz#Required module not available: spwdc�L�eZdZddd�Zd�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zy
)�UnixCheckerTestsrIrK)rHrJc��tj|tj|j|d�dddddddf	�S)N�F/ri������)r�struct_spwdr�users)r*rgs  r�_spwd_getspnamzUnixCheckerTests._spwd_getspnam�sI���������D�J�J�x�0�$�7��������

�
�	
r.c
�n�tjdd�|_tjdd�|_tjdd�|_tjdd�|_t
jd�|_tjd	d
�|_	tjdd�|_
tjdd
�|_tjdd�|_t
jd�|_
tr{t�}|j j#�D]3\}}|j%|t&j'|d�dd|d|zd��5|j)td|j*�t,r"|j)t,d|j.�yy)NrHrIrJrKrLrMrN�unix�admin�asdf�alice�foo�foobar�x�yzr�i�z/home/z/bin/sh�getpwnam�getspnam)r
rOrHrJrPrQrr'rR�
adminBytes�
aliceBytes�badPassBytes�badUserBytes�checkerBytesrrr��items�addUserr�patchr�rr�)r*�databaserg�passwords    rrSzUnixCheckerTests.setUp�s_�� �1�1�'�6�B��
� �1�1�'�5�A��
�"�3�3�G�X�F���"�3�3�C��>����*�*�6�2���%�6�6�x��I���%�6�6�x��H���'�8�8��9�M���'�8�8��u�E���#�/�/��7����#�~�H�&*�j�j�&6�&6�&8�	
�"��(�� � ���K�K��$�/�����x�'���	
�
�J�J�s�J��(9�(9�:���J�J�t�Z��)<�)<�=�r.c��|jtjj|j��|jtj|jj�|jtjj|j��|jtj|jj�y)z�
        Verifies that strcred.makeChecker('unix') returns an object
        that implements the L{ICredentialsChecker} interface.
        N)
rWr	rXrYrRr;r
rZr[r�rCs rr\zUnixCheckerTests.test_isChecker�s���
	
����4�4�?�?����M�N��
�
�k�3�3�T�\�\�5V�5V�W�����4�4�?�?��@Q�@Q�R�S��
�
��)�)�4�+<�+<�+Q�+Q�	
r.c�v���fd�}�jj�j�j|�S)rbc�R���j|�jj�yrdrerhs �rriz=UnixCheckerTests.test_unixCheckerSucceeds.<locals>._gotAvatar�rjr.rkrns` r�test_unixCheckerSucceedsz)UnixCheckerTests.test_unixCheckerSucceeds�rpr.c�v���fd�}�jj�j�j|�S)zD
        The checker works with valid L{bytes} credentials.
        c�p���j|�jjjd��y)N�utf-8)rfr�rg�decoderhs �rrizBUnixCheckerTests.test_unixCheckerSucceedsBytes.<locals>._gotAvatar�s(������X�t���'?�'?�'F�'F�w�'O�Pr.)r�rlr�rmrns` r�test_unixCheckerSucceedsBytesz.UnixCheckerTests.test_unixCheckerSucceedsBytes�s6���
	Q�� � �0�0����A�M�M��
�	
r.c��|j|jj|j�tj
�SrrrsrCs r�test_unixCheckerFailsUsernamez.UnixCheckerTests.test_unixCheckerFailsUsername�rwr.c��|j|jj|j�tj
�S)zF
        The checker fails with an invalid L{bytes} username.
        )rtr�rlr�rrurCs r�"test_unixCheckerFailsUsernameBytesz3UnixCheckerTests.test_unixCheckerFailsUsernameBytes��:���!�!����-�-�d�.?�.?�@��#�#�
�	
r.c��|j|jj|j�tj
�SryrzrCs r�test_unixCheckerFailsPasswordz.UnixCheckerTests.test_unixCheckerFailsPasswordrwr.c��|j|jj|j�tj
�S)zF
        The checker fails with an invalid L{bytes} password.
        )rtr�rlr�rrurCs r�"test_unixCheckerFailsPasswordBytesz3UnixCheckerTests.test_unixCheckerFailsPasswordBytesr�r.N)
r1r2r3r�r�rSr\r�r�r�r�r�r�r4r.rr�r��s?��
��
�E�


�>�<

�P�

�
�
�
�
r.r�z%Required module is unavailable: cryptc��eZdZdZd�Zd�Zy)�
CryptTestsz9
    L{crypt} has functions for encrypting password.
    c��d}dD]�}	tj||�}t|t�r|jd�}d}|jt
j||��|jt
j||����dD�]-}tt|d�}|s�d}tj||�}t|t�r|jd�}|dz}t
j||�}	|j|	�t
j|jd�|jd��}	|j|	�t
j||�}	|j|	�t
j|jd�|jd��}	|j|	���0y#t$rY���wxYw)	z4
        L{cred_unix.verifyCryptedPassword}
        �sample password ^%$)N�abr�z$1x1234)�
METHOD_SHA512�
METHOD_SHA256�
METHOD_MD5�METHOD_CRYPTNzinteresting password xyz�blahfooincorrect)r�
isinstance�bytesr��	TypeErrorrWr�verifyCryptedPassword�assertFalse�getattr�encode)
r*r��salt�cryptedCorrect�cryptedIncorrect�method�cryptMethod�crypted�incorrectCrypted�results
          r�test_verifyCryptedPasswordz%CryptTests.test_verifyCryptedPasswords���)�� �	�D�
�!&���X�t�!<���n�e�4�%3�%:�%:�7�%C�N� )���O�O�I�;�;�N�H�U�V�����/�/�0@�(�K�
�	�$W�	%�F�!�%���6�K���1�H��k�k�(�K�8�G��'�5�)�!�.�.��1��&�);�;���4�4�W�h�G�F��O�O�F�#��4�4����w�'�����)A��F�
�O�O�F�#��4�4�5E�x�P�F����V�$��4�4� �'�'��0�(�/�/�'�2J��F�
���V�$�-	%���
��	
�s�7G�	G�Gc��d�}d}tj|d�}|jtd|�|jtj||��y)zK
        L{cred_unix.verifyCryptedPassword} when OSError is raised
        c��td��)N�)�OSError)r�r�s  r�	mockCryptz?CryptTests.test_verifyCryptedPasswordOSError.<locals>.mockCryptPs���"�+�r.r�r�rN)rr�r�rr�)r*r�r�r�s    r�!test_verifyCryptedPasswordOSErrorz,CryptTests.test_verifyCryptedPasswordOSErrorKsI��
	�)�����X�t�4���
�
�5�'�9�-�����8�8���R�Sr.N)r1r2r3�__doc__r�r�r4r.rr�r�s���.%�`Tr.r�c�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�FileDBCheckerTestsz*
    C{--auth=file:...} file checker.
    c��tjdd�|_tjdd�|_tjdd�|_tjdd�|_|j
�|_t|j�jd�tjd	|jz�|_y)
Nr�r�r�r�r�r�r��admin:asdf
alice:foo
�file:)
r
rOrHrJrPrQ�mktemp�filenamer�
setContentrr'rRrCs rrSzFileDBCheckerTests.setUp^s��� �1�1�(�G�D��
� �1�1�(�F�C��
�"�3�3�H�i�H���"�3�3�D�%�@������
��
������*�*�+E�F��*�*�7�T�]�]�+B�C��r.c��d}tjj|�r%|dz
}tjj|�r�%|S)Nz
/DoesNotExistr)�os�path�exists)r*r�s  r�
_fakeFilenamez FileDBCheckerTests._fakeFilenamegs7��"���g�g�n�n�X�&���O�H��g�g�n�n�X�&��r.c���|jtjj|j��|jtj|jj�yrUrVrCs rr\z!FileDBCheckerTests.test_isCheckermr]r.c�v���fd�}�jj�j�j|�S)rbc�R���j|�jj�yrdrerhs �rriz?FileDBCheckerTests.test_fileCheckerSucceeds.<locals>._gotAvatarzrjr.rkrns` r�test_fileCheckerSucceedsz+FileDBCheckerTests.test_fileCheckerSucceedsurpr.c��|j|jj|j�tj
�SrrrsrCs r�test_fileCheckerFailsUsernamez0FileDBCheckerTests.test_fileCheckerFailsUsernamerwr.c��|j|jj|j�tj
�SryrzrCs r�test_fileCheckerFailsPasswordz0FileDBCheckerTests.test_fileCheckerFailsPassword�rwr.c��|jttjd�|jttjd�y)z4
        An empty filename raises an error.
        r@r�N)r%�
ValueErrorrr'rCs r�test_failsWithEmptyFilenamez.FileDBCheckerTests.test_failsWithEmptyFilename�s4��	
���*�g�&9�&9�6�B����*�g�&9�&9�7�Cr.c�H�tjj}t�}|tj_t	j
d|j
�z�|tj_|jtj|j��y)zt
        When the file auth plugin is given a file that doesn't exist, it
        should produce a warning.
        r�N)
rrB�errorOutputrrr'r�r;�invalidFileWarning�getvalue)r*�	oldOutput�	newOutputs   r�test_warnWithBadFilenamez+FileDBCheckerTests.test_warnWithBadFilename�sq��
�3�3�?�?�	��J�	�6?�	�'�'�3����G�d�&8�&8�&:�:�;�6?�	�'�'�3��
�
�i�2�2�I�4F�4F�4H�Ir.N)r1r2r3r�rSr�r\r�r�r�r�r�r4r.rr�r�Ys4���D��X�P�
�
�D�
Jr.r��cryptographyzcryptography is not availablec��eZdZdZd�Zy)�SSHCheckerTestsz�
    Tests for the C{--auth=sshkey:...} checker.  The majority of the
    tests for the ssh public key database checker are in
    L{twisted.conch.test.test_checkers.SSHPublicKeyCheckerTestCase}.
    c���tjd�}|jtjj|��|j
tj|j�y)z�
        Verifies that strcred.makeChecker('sshkey') returns an object
        that implements the L{ICredentialsChecker} interface.
        �sshkeyN)
rr'rWr	rXrYr;r
�ISSHPrivateKeyr[)r*�
sshCheckers  rr\zSSHCheckerTests.test_isChecker�sK��
�(�(��2�
�����4�4�?�?�
�K�L��
�
�k�0�0�*�2Q�2Q�Rr.N)r1r2r3r�r\r4r.rr�r��s
���Sr.r�c��eZdZdZy)�DummyOptionsz@
    Simple options for testing L{strcred.AuthOptionMixin}.
    N)r1r2r3r�r4r.rrr�s��r.rc�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�CheckerOptionsTestsc���t�}|jddg�|jt|d�d�t�}|jgd��|jt|d�d�y)zu
        The C{--auth} command line creates a list in the
        Options instance and appends values to it.
        �--auth�memory�credCheckers�)rrrr�N)r�parseOptionsrf�len�r*�optionss  r�test_createsListz$CheckerOptionsTests.test_createsList�sh��
�.�����h��1�2�����W�^�4�5�q�9��.�����E�F�����W�^�4�5�q�9r.c���t�}t�}|jtj|j
d|g�|jtj|j
d|g�y)zx
        The C{--auth} command line raises an exception when it
        gets a parameter it doesn't understand.
        r�--help-auth-typeN)rr r%r�
UsageErrorr	)r*r�invalidParameters   r�test_invalidAuthErrorz)CheckerOptionsTests.test_invalidAuthError�sh��
�.��.�/��������g�2�2�X�?O�4P�	
�	
������� � �
�!1�2�	
r.c��t�}|jgd��|d}|jt|tj
�d�|jt|tj�d�|tj
d}|tjd}|jtjj|��|jtjj|��|jtj
|j�|jtj|j�y)z�
        The C{--auth} command line creates a dictionary mapping supported
        interfaces to the list of credentials checkers that support it.
        )rrrr�credInterfacesrrN)
rr	rfr
r
r�rZrWr	rXrYr;r[)r*r�chd�chdAnonymous�chdUserPasss     r�test_createsDictionaryz*CheckerOptionsTests.test_createsDictionary�s���
�.�����H�I��&�'������S��!7�!7�8�9�1�=�����S��!>�!>�?�@�!�D��;�1�1�2�1�5���+�7�7�8��;������4�4�?�?��M�N�����4�4�?�?��L�M��
�
�k�,�,�l�.O�.O�P��
�
�k�3�3�[�5U�5U�Vr.c��t�}|jgd��|j|d|dtj�y)z�
        When two C{--auth} arguments are passed along which support the same
        interface, a list with both is created.
        )rrrr�rrN)rr	rfr
rZrs  r� test_credInterfacesProvidesListsz4CheckerOptionsTests.test_credInterfacesProvidesLists�sD��
�.�����C�D�����N�#��$�%�k�&C�&C�D�	
r.c��g}t�}|j�D]9}|j|j|�|j	|j��;y)zG
        The list for C{--help-auth} does not duplicate items.
        N)r�_checkerFactoriesForOptHelpAuth�assertNotInr�append)r*�	authTypesr�cfs    r�!test_listDoesNotDisplayDuplicatesz5CheckerOptionsTests.test_listDoesNotDisplayDuplicates�sN���	��.���9�9�;�	*�B����R�[�[�)�4����R�[�[�)�	*r.c��t�}t�}||_|jt|j
dg�t
j�D],}|j|j|j���.y)zz
        The C{--help-auth} argument correctly displays all
        available authentication plugins, then exits.
        z--help-authN)rr�
authOutputr%�
SystemExitr	rrr;rr�)r*�	newStdoutr�checkerFactorys    r�test_displaysListCorrectlyz.CheckerOptionsTests.test_displaysListCorrectlysk��
�J�	��.��&������*�g�&:�&:�]�O�L�%�:�:�<�	I�N��M�M�.�1�1�9�3E�3E�3G�H�	Ir.c�<�t�}t�}||_|jt|j
ddg�tjjD]A}|j�s�|j|j�|j���Cy)z�
        The C{--help-auth-for} argument will correctly display the help file
        for a particular authentication plugin.
        rr@N)rrr#r%r$r	rrB�authHelp�stripr;r�)r*r%r�lines    r�test_displaysHelpCorrectlyz.CheckerOptionsTests.test_displaysHelpCorrectlys���
�J�	��.��&��������,�,�/A�6�.J�	
��3�3�<�<�	B�D��z�z�|��
�
�d�j�j�l�I�,>�,>�,@�A�	Br.c��t�}|jtj|jddg�}|jt
|�d�y)z�
        When the checker specified by C{--auth} raises an unexpected error, it
        should be caught and re-raised within a L{usage.UsageError}.
        rr@z,Unexpected error: 'file' requires a filenameN)rr%rrr	rf�str)r*r�errs   r�test_unexpectedExceptionz,CheckerOptionsTests.test_unexpectedExceptionsJ��
�.��������g�2�2�X�v�4F�
��	
����S��#Q�Rr.N)r1r2r3r
rrrr!r'r,r0r4r.rrr�s.��
:�
�$W�"

�*�
I�
B�	Sr.rc�&�eZdZejfZy)�OptionsForUsernamePasswordN)r1r2r3r
rZ�supportedInterfacesr4r.rr2r2)s��&�8�8�:�r.r2c�&�eZdZejfZy)� OptionsForUsernameHashedPasswordN)r1r2r3r
�IUsernameHashedPasswordr3r4r.rr5r5-s��&�>�>�@�r.r5c��eZdZdZy)�OptionsSupportsAllInterfacesN)r1r2r3r3r4r.rr8r81s���r.r8c�(�eZdZUgZeeeed<y)�OptionsSupportsNoInterfacesr3N)r1r2r3r3rrr�__annotations__r4r.rr:r:5s��57���$�y�/�2�7r.r:c�L�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�LimitingInterfacesTestsa�
    Tests functionality that allows an application to limit the
    credential interfaces it can support. For the purposes of this
    test, we use IUsernameHashedPassword, although this will never
    really be used by the command line.

    (I have, to date, not thought of a half-decent way for a user to
    specify a hash algorithm via the command-line. Nor do I think it's
    very useful.)

    I should note that, at first, this test is counter-intuitive,
    because we're using the checker with a pre-defined hash function
    as the 'bad' checker. See the documentation for
    L{twisted.cred.checkers.FilePasswordDB.hash} for more details.
    c��|j�|_t|jd�5}|jd�ddd�t	j
|j�|_t	j
|j|j��|_t	j�|_
y#1swY�wxYw)N�wbr�)�hash)r�r��open�writer	�FilePasswordDB�goodChecker�_hash�
badChecker�AllowAnonymousAccess�anonChecker)r*�fs  rrSzLimitingInterfacesTests.setUpJs������
��
�
�$�-�-��
&�	0�!�
�G�G�.�/�	0�#�2�2�4�=�=�A���"�1�1�$�-�-�d�j�j�Q���#�8�8�:���		0�	0�s�B4�4B=c��|S)z>
        A dumb hash that doesn't really do anything.
        r4)r*�networkUsername�networkPassword�storedPasswords    rrEzLimitingInterfacesTests._hashRs
���r.c�:�t�}|j|jtj��|j|jtj��|jtj|j|j�y)zE
        The supportsInterface method behaves appropriately.
        N)r2rW�supportsInterfacer
rZr�r�r%r�UnsupportedInterfaces�
addCheckerrHrs  r�test_supportsInterfacez.LimitingInterfacesTests.test_supportsInterfaceXso��-�.������1�1�+�2O�2O�P�Q�����2�2�;�3I�3I�J�K�����)�)�7�+=�+=�t�?O�?O�	
r.c���t�}|j|jtj��|j|jtj
��y)z|
        The supportsInterface method behaves appropriately
        when the supportedInterfaces attribute is None.
        N)r8rWrOr
rZr�rs  r�test_supportsAllInterfacesz2LimitingInterfacesTests.test_supportsAllInterfacescsF��
/�0������1�1�+�2O�2O�P�Q�����1�1�+�2H�2H�I�Jr.c���t�}tj}tj}|j|j
|��|j|j
|��y)zJ
        The supportsCheckerFactory method behaves appropriately.
        N)r2rrBr
�theAnonymousCheckerFactoryrW�supportsCheckerFactoryr�)r*r�fileCF�anonCFs    r�test_supportsCheckerFactoryz3LimitingInterfacesTests.test_supportsCheckerFactorylsR��-�.���0�0���:�:������6�6�v�>�?�����7�7��?�@r.c�x�t�}|j|j�|jd}|j	|d|d|j�|j	|dd|j�|jt
|d|�d�|jt
|d�d�y)z�
        When addChecker is called with a checker that implements at least one
        of the interfaces our application supports, it is successful.
        rrrrN)r2rQrDr3rArfr
)r*r�ifaces   r�test_canAddSupportedCheckerz3LimitingInterfacesTests.test_canAddSupportedCheckervs���
-�.�����4�+�+�,��+�+�A�.�����W�%5�6�u�=�a�@�$�BR�BR�S����W�^�4�Q�7��9I�9I�J�����W�%5�6�u�=�>��B�����W�^�4�5�q�9r.c��t�}|jtj|j|j
�y)z~
        When addChecker is called with a checker that does not implement any
        supported interfaces, it fails.
        N)r5r%rrPrQrFrs  r�#test_failOnAddingUnsupportedCheckerz;LimitingInterfacesTests.test_failOnAddingUnsupportedChecker�s1��
3�4������)�)�7�+=�+=�t���	
r.c��t�}tjj}|j	t
j|jd|g�y)zq
        The C{--auth} command line raises an exception when it
        gets a checker we don't support.
        rN)r:r
rVrr%rrr	)r*rrs   r�test_unsupportedInterfaceErrorz6LimitingInterfacesTests.test_unsupportedInterfaceError�s@��
.�/��!�<�<�E�E�����%�*�*�G�,@�,@�8�X�BV�Wr.c��t�}|j�D]?}d}|jD]}|j|�s�d}�|s�-t	j
��y)z�
        C{--help-auth} will only list checkers that purport to
        supply at least one of the credential interfaces our
        application can use.
        TFN)r2rr[rOrrP)r*rr�invalid�	interfaces     r�test_helpAuthLimitsOutputz1LimitingInterfacesTests.test_helpAuthLimitsOutput�se��-�.���>�>�@�	6�G��G�$�9�9�
$�	��,�,�Y�7�#�G�
$���3�3�5�5�
	6r.c�`�t�}d}tj�D]}|j|�r�|}n|j	|d�t�}||_|jt|jddg�|jtj|j��y)z�
        C{--help-auth-type} will display a warning if you get
        help for an authType that does not supply at least one of the
        credential interfaces our application can use.
        Nrr)
r2rrrW�assertNotIdenticalrr#r%r$r	r;�notSupportedWarningr�)r*r�invalidFactoryrr%s     r�test_helpAuthTypeLimitsOutputz5LimitingInterfacesTests.test_helpAuthTypeLimitsOutput�s���-�.�����3�3�5�	�G��1�1�'�:�!(���	�	
�����5��J�	�&��������,�,�/A�;�.O�	
�	
�
�
�g�1�1�9�3E�3E�3G�Hr.N)r1r2r3r�rSrErRrTrZr]r_rarerjr4r.rr=r=9s=��� ;��	
�K�A�
:�
�X�
6�Ir.r=)5r�r��ior�typingrr�unittestr�zope.interfacer�twistedr�twisted.credr	r
rr�twisted.pluginsr
rr�twisted.pythonr�twisted.python.fakepwdr�twisted.python.filepathr�twisted.python.reflectr�twisted.trial.unittestrrrrr r"r6rFr}r�r�r�r��Options�AuthOptionMixinrrr2r5r8r:r=r4r.r�<module>rys����

��!��$��>�>�@�@� �/�,�0�+��g����E����V���	�T�X�T�$
�H�
�&1
��1
�h/�H�/�.�C��5�6��E�	�9�:��D��7�8�u
�x�u
�9�;�7�u
�p�E�	�:�;�@T��@T�<�@T�FGJ��GJ�T�C��5�6��M�.�)�)�+J�K�S�h�S�L�7�S�"�5�=�=�'�"9�"9��jS�(�jS�Z;�����0G�0G�;�A�u�}�}�g�6M�6M�A��5�=�=�'�2I�2I��8�%�-�-��1H�1H�8�BI�h�BIr.

Zerion Mini Shell 1.0