
    Vh                     `    d Z ddlmZmZmZ ddlmZ ddlmZ  G d de      Z	 G d de      Z
y	)
z<
Tests for basic constructs of L{twisted.cred.credentials}.
    )IUsernameHashedPasswordIUsernamePasswordUsernamePassword)_uhpVersion)TestCasec                   0    e Zd ZdZddZddZddZddZy)UsernamePasswordTestsz(
    Tests for L{UsernamePassword}.
    Nc                     t        dd      }| j                  |j                  d       | j                  |j                  d       y)zo
        The initialisation of L{UsernamePassword} will set C{username} and
        C{password} on it.
           foo   barN)r   assertEqualusernamepasswordselfcredss     Q/home/dcms/DCMS/lib/python3.12/site-packages/twisted/cred/test/test_simpleauth.pytest_initialisationz)UsernamePasswordTests.test_initialisation   s8    
 !000    c                 \    t        dd      }| j                  |j                  d             y)z
        Calling C{checkPassword} on a L{UsernamePassword} will return L{True}
        when the password given is the password on the object.
           user   passN)r   
assertTruecheckPasswordr   s     r   test_correctPasswordz*UsernamePasswordTests.test_correctPassword    s'    
 !'2++G45r   c                 \    t        dd      }| j                  |j                  d             y)z
        Calling C{checkPassword} on a L{UsernamePassword} will return L{False}
        when the password given is NOT the password on the object.
        r   r      someotherpassN)r   assertFalser   r   s     r   test_wrongPasswordz(UsernamePasswordTests.test_wrongPassword(   s*    
 !'2,,-=>?r   c                 T    | j                  t        j                  t                     y)zF
        L{UsernamePassword} implements L{IUsernamePassword}.
        N)r   r   implementedByr   )r   s    r   test_interfacez$UsernamePasswordTests.test_interface0   s     	)778HIJr   returnN__name__
__module____qualname____doc__r   r   r   r"    r   r   r	   r	      s    16@Kr   r	   c                   0    e Zd ZdZddZddZddZddZy)UsernameHashedPasswordTestsz.
    Tests for L{UsernameHashedPassword}.
    Nc                     | j                  ddt              } |dd      }| j                  |j                  d       | j                  |j                  d       y)zs
        The initialisation of L{UsernameHashedPassword} will set C{username}
        and C{hashed} on it.
        twisted.cred.credentialsUsernameHashedPasswordr   r   N)getDeprecatedModuleAttributer   r   r   hashedr   r/   r   s      r   r   z/UsernameHashedPasswordTests.test_initialisation<   sS    
 "&!B!B&(@+"
 'vv60v.r   c                     | j                  ddt              } |dd      }| j                  |j                  d             y)z
        Calling C{checkPassword} on a L{UsernameHashedPassword} will return
        L{True} when the password given is the password on the object.
        r.   r/   r   r   N)r0   r   r   r   r2   s      r   r   z0UsernameHashedPasswordTests.test_correctPasswordH   sB    
 "&!B!B&(@+"
 'w8++G45r   c                     | j                  ddt              } |dd      }| j                  |j                  d             y)z
        Calling C{checkPassword} on a L{UsernameHashedPassword} will return
        L{False} when the password given is NOT the password on the object.
        r.   r/   r   r   r   N)r0   r   r   r   r2   s      r   r   z.UsernameHashedPasswordTests.test_wrongPasswordS   sE    
 "&!B!B&(@+"
 'w8,,-=>?r   c                 z    | j                  ddt              }| j                  t        j                  |             y)zR
        L{UsernameHashedPassword} implements L{IUsernameHashedPassword}.
        r.   r/   N)r0   r   r   r   r!   )r   r/   s     r   r"   z*UsernameHashedPasswordTests.test_interface^   s8     "&!B!B&(@+"
 	/==>TUVr   r#   r%   r*   r   r   r,   r,   7   s    
/	6	@Wr   r,   N)r)   twisted.cred.credentialsr   r   r   twisted.cred.test.test_credr   twisted.trial.unittestr   r	   r,   r*   r   r   <module>r9      s9   
 
 4 +"KH "KJ.W( .Wr   