§
    Étºf£@  ã                   óÄ  — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
mZmZ ddlmZ ddlmZ 	 dd	lmZ d
Zn# e$ r dZdZY nw xY wdZdZdZdez  ZdZdez  Z G d„ dej        ¦  «        Z G d„ d¦  «        Z G d„ deej        ¦  «        Z G d„ deej        ¦  «        Z G d„ deej        ¦  «        Z G d„ dej        ¦  «        Z  G d„ d ej        ¦  «        Z!dS )!z4
Tests for L{twisted.words.protocols.jabber.client}
é    )Úsha1)ÚskipIf)Údefer)Úunittest)ÚclientÚerrorÚjidÚ	xmlstream)ÚSASLInitiatingInitializer)Úutility)Ússl)FÚ N)TzSSL not availablez//iq[@type="get"]/query[@xmlns="jabber:iq:auth"]z//iq[@type="set"]/query[@xmlns="jabber:iq:auth"]z urn:ietf:params:xml:ns:xmpp-bindz"/iq[@type="set"]/bind[@xmlns="%s"]z#urn:ietf:params:xml:ns:xmpp-sessionz%/iq[@type="set"]/session[@xmlns="%s"]c                   ó    — e Zd Zd„ Zd„ Zd„ ZdS )ÚCheckVersionInitializerTestsc                 ó†   — t          j        ¦   «         }t          j        |¦  «        }t          j        |¦  «        | _        d S ©N)r
   ÚAuthenticatorÚ	XmlStreamr   ÚCheckVersionInitializerÚinit)ÚselfÚaÚxss      úc/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/words/test/test_jabberclient.pyÚsetUpz"CheckVersionInitializerTests.setUp#   s6   € ÝÔ#Ñ%Ô%ˆÝÔ  Ñ#Ô#ˆÝÔ2°2Ñ6Ô6ˆŒ	ˆ	ˆ	ó    c                 óZ   — d| j         j        _        | j                              ¦   «          dS )z3
        Test supported version number 1.0
        )é   r   N)r   r
   ÚversionÚ
initialize©r   s    r   ÚtestSupportedz*CheckVersionInitializerTests.testSupported(   s+   € ð '-ˆŒ	ÔÔ#ØŒ	×ÒÑÔÐÐÐr   c                 ó²   — d| j         j        _        |                      t          j        | j         j        ¦  «        }|                      d|j        ¦  «         dS )zK
        Test unsupported version number 0.0, and check exception.
        )r   r   zunsupported-versionN)	r   r
   r   ÚassertRaisesr   ÚStreamErrorr    ÚassertEqualÚ	condition)r   Úexcs     r   ÚtestNotSupportedz-CheckVersionInitializerTests.testNotSupported/   sM   € ð '-ˆŒ	ÔÔ#Ø×Ò¥Ô 1°4´9Ô3GÑHÔHˆØ×ÒÐ.°´Ñ>Ô>Ð>Ð>Ð>r   N)Ú__name__Ú
__module__Ú__qualname__r   r"   r)   © r   r   r   r   "   sA   € € € € € ð7ð 7ð 7ð
ð ð ð?ð ?ð ?ð ?ð ?r   r   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚInitiatingInitializerHarnessaè  
    Testing harness for interacting with XML stream initializers.

    This sets up an L{utility.XmlPipe} to create a communication channel between
    the initializer and the stubbed receiving entity. It features a sink and
    source side that both act similarly to a real L{xmlstream.XmlStream}. The
    sink is augmented with an authenticator to which initializers can be added.

    The harness also provides some utility methods to work with event observers
    and deferreds.
    c                 óº   — g | _         t          j        ¦   «         | _        | j        j        | _        t          j        d¦  «        | _        | j        | j        _        d S )Nzexample.org)Úoutputr   ÚXmlPipeÚpipeÚsinkr
   ÚConnectAuthenticatorÚauthenticatorr!   s    r   r   z"InitiatingInitializerHarness.setUpE   sI   € ØˆŒÝ”OÑ%Ô%ˆŒ	ØœœˆŒÝ&Ô;¸MÑJÔJˆÔØ'+Ô'9ˆŒÔ$Ð$Ð$r   c                 ó    — t          j        ¦   «         }|                     |¦  «         | j        j                             ||j        ¦  «         |S )aù  
        Observe an output event, returning a deferred.

        The returned deferred will be fired when the given event has been
        observed on the source end of the L{XmlPipe} tied to the protocol
        under test. The handler is added as the first callback.

        @param event: The event to be observed. See
            L{utility.EventDispatcher.addOnetimeObserver}.
        @param handler: The handler to be called with the observed event object.
        @rtype: L{defer.Deferred}.
        )r   ÚDeferredÚaddCallbackr3   ÚsourceÚaddOnetimeObserverÚcallback)r   ÚeventÚhandlerÚds       r   ÚwaitForz$InitiatingInitializerHarness.waitForL   sE   € õ ŒNÑÔˆØ	�Š�gÑÔÐØŒ	Ô×+Ò+¨E°1´:Ñ>Ô>Ð>Øˆr   N)r*   r+   r,   Ú__doc__r   r@   r-   r   r   r/   r/   8   s<   € € € € € ð
ð 
ð:ð :ð :ðð ð ð ð r   r/   c                   ó:   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zd„ Zd„ Zˆ xZ	S )ÚIQAuthInitializerTestsz0
    Tests for L{client.IQAuthInitializer}.
    c                 óØ   •— t          ¦   «                              ¦   «          t          j        | j        ¦  «        | _        t          j        d¦  «        | j        _        d| j        _	        d S )Núuser@example.com/resourceÚsecret)
Úsuperr   r   ÚIQAuthInitializerr
   r   r	   ÚJIDr6   Úpassword©r   Ú	__class__s    €r   r   zIQAuthInitializerTests.setUpd   sO   ø€ Ý‰Œ�Š‰ŒˆÝÔ,¨T¬^Ñ<Ô<ˆŒ	Ý!$¤Ð)DÑ!EÔ!EˆÔÔØ&.ˆÔÔ#Ð#Ð#r   c                 ó°   ‡ ‡— ˆˆ fd„}ˆ fd„Š‰                       t          |¦  «        }‰ j                             ¦   «         }t	          j        ||g¦  «        S )zè
        Test plain-text authentication.

        Act as a server supporting plain-text authentication and expect the
        C{password} field to be filled with the password. Then act as if
        authentication succeeds.
        c                 ól  •— t          j        | d¦  «        }|                     d¦  «         |j                             d¦  «         |j                             d¦  «         |j                             d¦  «         ‰                     t
          ‰¦  «        }‰j        j                             |¦  «         |S ©zÄ
            Called when the initializer sent a query for authentication methods.

            The response informs the client that plain-text authentication
            is supported.
            Úresult©zjabber:iq:authÚqueryÚusernamerJ   Úresource©	r
   Ú
toResponseÚ
addElementrR   r@   ÚIQ_AUTH_SETr3   r:   Úsend©ÚiqÚresponser?   Ú	onAuthSetr   s      €€r   Ú	onAuthGetz7IQAuthInitializerTests.testPlainText.<locals>.onAuthGets   ó£   ø€ õ !Ô+¨B°Ñ9Ô9ˆHØ×ÒÐ ;Ñ<Ô<Ð<ØŒN×%Ò% jÑ1Ô1Ð1ØŒN×%Ò% jÑ1Ô1Ð1ØŒN×%Ò% jÑ1Ô1Ð1ð —’�[¨)Ñ4Ô4ˆAð ŒIÔ×!Ò! (Ñ+Ô+Ð+àˆHr   c                 ó~  •— ‰                      dt          | j        j        ¦  «        ¦  «         ‰                      dt          | j        j        ¦  «        ¦  «         ‰                      dt          | j        j        ¦  «        ¦  «         t          j        | d¦  «        }‰j        j	         
                    |¦  «         dS )úÇ
            Called when the initializer sent the authentication request.

            The server checks the credentials and responds with an empty result
            signalling success.
            ÚuserrF   rT   rP   N)r&   ÚstrrR   rS   rJ   rT   r
   rV   r3   r:   rY   ©r[   r\   r   s     €r   r]   z7IQAuthInitializerTests.testPlainText.<locals>.onAuthSetŠ   s¡   ø€ ð ×Ò˜V¥S¨¬Ô):Ñ%;Ô%;Ñ<Ô<Ð<Ø×Ò˜X¥s¨2¬8Ô+<Ñ'=Ô'=Ñ>Ô>Ð>Ø×Ò˜Z­¨R¬XÔ->Ñ)?Ô)?Ñ@Ô@Ð@õ !Ô+¨B°Ñ9Ô9ˆHØŒIÔ×!Ò! (Ñ+Ô+Ð+Ð+Ð+r   )r@   ÚIQ_AUTH_GETr   r    r   ÚgatherResults©r   r^   Úd1Úd2r]   s   `   @r   ÚtestPlainTextz$IQAuthInitializerTests.testPlainTextj   sz   øø€ ð	ð 	ð 	ð 	ð 	ð 	ð.	,ð 	,ð 	,ð 	,ð 	,ð  �\Š\�+ yÑ1Ô1ˆð ŒY×!Ò!Ñ#Ô#ˆÝÔ" B¨ 8Ñ,Ô,Ð,r   c                 óÈ   ‡ ‡— ˆˆ fd„}ˆ fd„Šd‰ j         _        ‰                      t          |¦  «        }‰ j                             ¦   «         }t          j        ||g¦  «        S )a"  
        Test digest authentication.

        Act as a server supporting digest authentication and expect the
        C{digest} field to be filled with a sha1 digest of the concatenated
        stream session identifier and password. Then act as if authentication
        succeeds.
        c                 ól  •— t          j        | d¦  «        }|                     d¦  «         |j                             d¦  «         |j                             d¦  «         |j                             d¦  «         ‰                     t
          ‰¦  «        }‰j        j                             |¦  «         |S )zÀ
            Called when the initializer sent a query for authentication methods.

            The response informs the client that digest authentication is
            supported.
            rP   rQ   rS   ÚdigestrT   rU   rZ   s      €€r   r^   z4IQAuthInitializerTests.testDigest.<locals>.onAuthGetª   s£   ø€ õ !Ô+¨B°Ñ9Ô9ˆHØ×ÒÐ ;Ñ<Ô<Ð<ØŒN×%Ò% jÑ1Ô1Ð1ØŒN×%Ò% hÑ/Ô/Ð/ØŒN×%Ò% jÑ1Ô1Ð1ð —’�[¨)Ñ4Ô4ˆAð ŒIÔ×!Ò! (Ñ+Ô+Ð+àˆHr   c                 ó¼  •— ‰                      dt          | j        j        ¦  «        ¦  «         ‰                      t	          d¦  «                             ¦   «         t          | j        j        ¦  «        ¦  «         ‰                      dt          | j        j        ¦  «        ¦  «         t          j	        | d¦  «        }‰j
        j                             |¦  «         dS )ra   rb   s   12345secretrT   rP   N)r&   rc   rR   rS   r   Ú	hexdigestrm   rT   r
   rV   r3   r:   rY   rd   s     €r   r]   z4IQAuthInitializerTests.testDigest.<locals>.onAuthSetÁ   s´   ø€ ð ×Ò˜V¥S¨¬Ô):Ñ%;Ô%;Ñ<Ô<Ð<Ø×Ò�T .Ñ1Ô1×;Ò;Ñ=Ô=½sÀ2Ä8Ä?Ñ?SÔ?SÑTÔTÐTØ×Ò˜Z­¨R¬XÔ->Ñ)?Ô)?Ñ@Ô@Ð@õ !Ô+¨B°Ñ9Ô9ˆHØŒIÔ×!Ò! (Ñ+Ô+Ð+Ð+Ð+r   Ú12345)r
   Úsidr@   re   r   r    r   rf   rg   s   `   @r   Ú
testDigestz!IQAuthInitializerTests.testDigest    s†   øø€ ð	ð 	ð 	ð 	ð 	ð 	ð.	,ð 	,ð 	,ð 	,ð 	,ð  %ˆŒÔð �\Š\�+ yÑ1Ô1ˆð ŒY×!Ò!Ñ#Ô#ˆåÔ" B¨ 8Ñ,Ô,Ð,r   c                 óâ   ‡ — ˆ fd„}‰                       t          |¦  «        }‰ j                             ¦   «         }‰                      |t
          j        ¦  «         t          j        ||g¦  «        S )zT
        Test initializer failure of request for fields for authentication.
        c                 ó”   •— t          j        d¦  «                             | ¦  «        }‰j        j                             |¦  «         dS )z²
            Called when the initializer sent a query for authentication methods.

            The server responds that the client is not authorized to authenticate.
            únot-authorizedN©r   ÚStanzaErrorrV   r3   r:   rY   rd   s     €r   r^   z?IQAuthInitializerTests.testFailRequestFields.<locals>.onAuthGetà   sC   ø€ õ Ô(Ð)9Ñ:Ô:×EÒEÀbÑIÔIˆHØŒIÔ×!Ò! (Ñ+Ô+Ð+Ð+Ð+r   ©	r@   re   r   r    ÚassertFailurer   rw   r   rf   )r   r^   rh   ri   s   `   r   ÚtestFailRequestFieldsz,IQAuthInitializerTests.testFailRequestFieldsÛ   sv   ø€ ð
	,ð 	,ð 	,ð 	,ð 	,ð �\Š\�+ yÑ1Ô1ˆð ŒY×!Ò!Ñ#Ô#ˆð 	×Ò˜2�uÔ0Ñ1Ô1Ð1åÔ" B¨ 8Ñ,Ô,Ð,r   c                 óð   ‡ ‡— ˆˆ fd„}ˆ fd„Š‰                       t          |¦  «        }‰ j                             ¦   «         }‰                      |t
          j        ¦  «         t          j        ||g¦  «        S )z;
        Test initializer failure to authenticate.
        c                 ól  •— t          j        | d¦  «        }|                     d¦  «         |j                             d¦  «         |j                             d¦  «         |j                             d¦  «         ‰                     t
          ‰¦  «        }‰j        j                             |¦  «         |S rO   rU   rZ   s      €€r   r^   z6IQAuthInitializerTests.testFailAuth.<locals>.onAuthGetù   r_   r   c                 ó”   •— t          j        d¦  «                             | ¦  «        }‰j        j                             |¦  «         dS )zÂ
            Called when the initializer sent the authentication request.

            The server checks the credentials and responds with a not-authorized
            stanza error.
            ru   Nrv   rd   s     €r   r]   z6IQAuthInitializerTests.testFailAuth.<locals>.onAuthSet  sC   ø€ õ Ô(Ð)9Ñ:Ô:×EÒEÀbÑIÔIˆHØŒIÔ×!Ò! (Ñ+Ô+Ð+Ð+Ð+r   rx   rg   s   `   @r   ÚtestFailAuthz#IQAuthInitializerTests.testFailAuthô   s•   øø€ ð
	ð 	ð 	ð 	ð 	ð 	ð.	,ð 	,ð 	,ð 	,ð 	,ð �\Š\�+ yÑ1Ô1ˆð ŒY×!Ò!Ñ#Ô#ˆð 	×Ò˜2�uÔ0Ñ1Ô1Ð1åÔ" B¨ 8Ñ,Ô,Ð,r   )
r*   r+   r,   rA   r   rj   rr   rz   r~   Ú__classcell__©rL   s   @r   rC   rC   _   s€   ø€ € € € € ðð ð/ð /ð /ð /ð /ð4-ð 4-ð 4-ðl9-ð 9-ð 9-ðv-ð -ð -ð2/-ð /-ð /-ð /-ð /-ð /-ð /-r   rC   c                   ó.   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zˆ xZS )ÚBindInitializerTestsz.
    Tests for L{client.BindInitializer}.
    c                 óÀ   •— t          ¦   «                              ¦   «          t          j        | j        ¦  «        | _        t          j        d¦  «        | j        _        d S )NrE   )	rG   r   r   ÚBindInitializerr
   r   r	   rI   r6   rK   s    €r   r   zBindInitializerTests.setUp+  sD   ø€ Ý‰Œ�Š‰ŒˆÝÔ*¨4¬>Ñ:Ô:ˆŒ	Ý!$¤Ð)DÑ!EÔ!EˆÔÔÐÐr   c                 óÖ   ‡ — ˆ fd„}ˆ fd„}‰                       t          |¦  «        }‰ j                             ¦   «         }|                     |¦  «         t          j        ||g¦  «        S )zK
        Set up a stream, and act as if resource binding succeeds.
        c                 óà   •— t          j        | d¦  «        }|                     t          df¦  «         |j                             dd¬¦  «         ‰j        j                             |¦  «         d S )NrP   Úbindr	   úuser@example.com/other resource)Úcontent)r
   rV   rW   ÚNS_BINDr‡   r3   r:   rY   rd   s     €r   ÚonBindz.BindInitializerTests.testBasic.<locals>.onBind5  si   ø€ Ý Ô+¨B°Ñ9Ô9ˆHØ×Ò¥¨&Ð 1Ñ2Ô2Ð2ØŒM×$Ò$ UÐ4UÐ$ÑVÔVÐVØŒIÔ×!Ò! (Ñ+Ô+Ð+Ð+Ð+r   c                 ól   •— ‰                      t          j        d¦  «        ‰j        j        ¦  «         d S )Nrˆ   )r&   r	   rI   r6   )rP   r   s    €r   Úcbz*BindInitializerTests.testBasic.<locals>.cb;  s;   ø€ Ø×ÒÝ”Ð9Ñ:Ô:¸DÔ<NÔ<Rñô ð ð ð r   )r@   ÚIQ_BIND_SETr   Ústartr9   r   rf   )r   r‹   r�   rh   ri   s   `    r   Ú	testBasiczBindInitializerTests.testBasic0  s‚   ø€ ð
	,ð 	,ð 	,ð 	,ð 	,ð	ð 	ð 	ð 	ð 	ð
 �\Š\�+ vÑ.Ô.ˆØŒY�_Š_ÑÔˆØ
�Š�rÑÔÐÝÔ" B¨ 8Ñ,Ô,Ð,r   c                 óâ   ‡ — ˆ fd„}‰                       t          |¦  «        }‰ j                             ¦   «         }‰                      |t
          j        ¦  «         t          j        ||g¦  «        S )zH
        Set up a stream, and act as if resource binding fails.
        c                 ó”   •— t          j        d¦  «                             | ¦  «        }‰j        j                             |¦  «         d S )NÚconflictrv   rd   s     €r   r‹   z0BindInitializerTests.testFailure.<locals>.onBindJ  s@   ø€ ÝÔ(¨Ñ4Ô4×?Ò?ÀÑCÔCˆHØŒIÔ×!Ò! (Ñ+Ô+Ð+Ð+Ð+r   )	r@   rŽ   r   r�   ry   r   rw   r   rf   )r   r‹   rh   ri   s   `   r   ÚtestFailurez BindInitializerTests.testFailureE  sp   ø€ ð
	,ð 	,ð 	,ð 	,ð 	,ð �\Š\�+ vÑ.Ô.ˆØŒY�_Š_ÑÔˆØ×Ò˜2�uÔ0Ñ1Ô1Ð1ÝÔ" B¨ 8Ñ,Ô,Ð,r   )r*   r+   r,   rA   r   r�   r”   r   r€   s   @r   r‚   r‚   &  se   ø€ € € € € ðð ðFð Fð Fð Fð Fð
-ð -ð -ð*-ð -ð -ð -ð -ð -ð -r   r‚   c                   ó.   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zˆ xZS )ÚSessionInitializerTestsz1
    Tests for L{client.SessionInitializer}.
    c                 ó„   •— t          ¦   «                              ¦   «          t          j        | j        ¦  «        | _        d S r   )rG   r   r   ÚSessionInitializerr
   r   rK   s    €r   r   zSessionInitializerTests.setUpY  s,   ø€ Ý‰Œ�Š‰ŒˆÝÔ-¨d¬nÑ=Ô=ˆŒ	ˆ	ˆ	r   c                 ó¢   ‡ — ˆ fd„}‰                       t          |¦  «        }‰ j                             ¦   «         }t	          j        ||g¦  «        S )zP
        Set up a stream, and act as if session establishment succeeds.
        c                 óp   •— t          j        | d¦  «        }‰j        j                             |¦  «         d S )NrP   )r
   rV   r3   r:   rY   rd   s     €r   Ú	onSessionz6SessionInitializerTests.testSuccess.<locals>.onSessionb  s4   ø€ Ý Ô+¨B°Ñ9Ô9ˆHØŒIÔ×!Ò! (Ñ+Ô+Ð+Ð+Ð+r   )r@   ÚIQ_SESSION_SETr   r�   r   rf   ©r   r›   rh   ri   s   `   r   ÚtestSuccessz#SessionInitializerTests.testSuccess]  sW   ø€ ð
	,ð 	,ð 	,ð 	,ð 	,ð �\Š\�.¨)Ñ4Ô4ˆØŒY�_Š_ÑÔˆÝÔ" B¨ 8Ñ,Ô,Ð,r   c                 óâ   ‡ — ˆ fd„}‰                       t          |¦  «        }‰ j                             ¦   «         }‰                      |t
          j        ¦  «         t          j        ||g¦  «        S )zM
        Set up a stream, and act as if session establishment fails.
        c                 ó”   •— t          j        d¦  «                             | ¦  «        }‰j        j                             |¦  «         d S )NÚ	forbiddenrv   rd   s     €r   r›   z6SessionInitializerTests.testFailure.<locals>.onSessiono  s@   ø€ ÝÔ(¨Ñ5Ô5×@Ò@ÀÑDÔDˆHØŒIÔ×!Ò! (Ñ+Ô+Ð+Ð+Ð+r   )	r@   rœ   r   r�   ry   r   rw   r   rf   r�   s   `   r   r”   z#SessionInitializerTests.testFailurej  sp   ø€ ð
	,ð 	,ð 	,ð 	,ð 	,ð �\Š\�.¨)Ñ4Ô4ˆØŒY�_Š_ÑÔˆØ×Ò˜2�uÔ0Ñ1Ô1Ð1ÝÔ" B¨ 8Ñ,Ô,Ð,r   )r*   r+   r,   rA   r   rž   r”   r   r€   s   @r   r–   r–   T  s`   ø€ € € € € ðð ð>ð >ð >ð >ð >ð-ð -ð -ð-ð -ð -ð -ð -ð -ð -r   r–   c                   ó   — e Zd ZdZd„ ZdS )ÚBasicAuthenticatorTestszB
    Test for both BasicAuthenticator and basicClientFactory.
    c                 ó$  — t          j        d¦  «        | _        t          j        | j        d¦  «                             d¦  «        }|                      d|j        j        ¦  «         |                      | j        |j        j         ¦  «         |                      d|j        j	        ¦  «         |j
        \  }}|                      |t          j        ¦  «         |                      |t          j        ¦  «         |                      |j        ¦  «         dS )a  
        Authenticator and stream are properly constructed by the factory.

        The L{xmlstream.XmlStream} protocol created by the factory has the new
        L{client.BasicAuthenticator} instance in its C{authenticator}
        attribute.  It is set up with C{jid} and C{password} as passed to the
        factory, C{otherHost} taken from the client JID. The stream futher has
        two initializers, for TLS and authentication, of which the first has
        its C{required} attribute set to C{True}.
        rE   rF   Núexample.com)r	   rI   Ú
client_jidr   ÚbasicClientFactoryÚbuildProtocolr&   r6   Ú	otherHostrJ   ÚinitializersÚassertIsInstancer
   ÚTLSInitiatingInitializerrH   ÚassertFalseÚrequired)r   r   ÚtlsÚauths       r   Ú
test_basicz"BasicAuthenticatorTests.test_basic~  sî   € õ œ'Ð"=Ñ>Ô>ˆŒõ
 Ô& t¤¸ÑAÔA×OÒOÐPTÑUÔUˆð 	×Ò˜¨Ô(8Ô(BÑCÔCÐCØ×Ò˜œ¨"Ô*:Ô*>Ñ?Ô?Ð?Ø×Ò˜ 2Ô#3Ô#<Ñ=Ô=Ð=ð ”O‰	ˆˆTà×Ò˜c¥9Ô#EÑFÔFÐFØ×Ò˜d¥FÔ$<Ñ=Ô=Ð=à×Ò˜œÑ&Ô&Ð&Ð&Ð&r   N)r*   r+   r,   rA   r±   r-   r   r   r£   r£   y  s-   € € € € € ðð ð'ð 'ð 'ð 'ð 'r   r£   c                   ó4   — e Zd ZdZd„ Z eeŽ d„ ¦   «         ZdS )ÚXMPPAuthenticatorTestsz@
    Test for both XMPPAuthenticator and XMPPClientFactory.
    c                 ó<  — t          j        d¦  «        | _        t          j        | j        d¦  «                             d¦  «        }|                      d|j        j        ¦  «         |                      | j        |j        j         ¦  «         |                      d|j        j	        ¦  «         |j
        \  }}}}}|                      |t          j        ¦  «         |                      |t          ¦  «         |                      |t          j        ¦  «         |                      |t          j        ¦  «         |                      |j        ¦  «         |                      |j        ¦  «         |                      |j        ¦  «         |                      |j        ¦  «         dS )zú
        Test basic operations.

        Setup an XMPPClientFactory, which sets up an XMPPAuthenticator, and let
        it produce a protocol instance. Then inspect the instance variables of
        the authenticator and XML stream objects.
        rE   rF   Nr¥   )r	   rI   r¦   r   ÚXMPPClientFactoryr¨   r&   r6   r©   rJ   rª   r«   r
   r¬   r   r„   r˜   Ú
assertTruer®   r­   )r   r   r   r¯   Úsaslr‡   Úsessions          r   r±   z!XMPPAuthenticatorTests.test_basic£  sa  € õ œ'Ð"=Ñ>Ô>ˆŒõ
 Ô% d¤o°xÑ@Ô@×NÒNÈtÑTÔTˆð 	×Ò˜¨Ô(8Ô(BÑCÔCÐCØ×Ò˜œ¨"Ô*:Ô*>Ñ?Ô?Ð?Ø×Ò˜ 2Ô#3Ô#<Ñ=Ô=Ð=ð -/¬OÑ)ˆ��d˜D 'à×Ò˜c¥9Ô#EÑFÔFÐFØ×Ò˜dÕ$=Ñ>Ô>Ð>Ø×Ò˜d¥FÔ$:Ñ;Ô;Ð;Ø×Ò˜g¥vÔ'@ÑAÔAÐAà�Š˜œÑ%Ô%Ð%Ø�Š˜œÑ&Ô&Ð&Ø�Š˜œÑ&Ô&Ð&Ø×Ò˜Ô)Ñ*Ô*Ð*Ð*Ð*r   c                 ó¦  ‡
— g Š
d	ˆ
fd„	}t          j        d¦  «        | _        t          j        ¦   «         }t          j        | j        d|¬¦  «        }|                      t          j	        d|¦  «         | 
                    d¦  «        }|j        \  }}}}}	|                      |t          j	        ¦  «         |                      |‰
d         ¦  «         dS )
zG
        A TLS configuration is passed to the TLS initializer.
        TNc                 ó2   •— ‰                      |¦  «         d S r   )Úappend)r   r   r®   ÚconfigurationForTLSÚconfigss       €r   r   z:XMPPAuthenticatorTests.test_tlsConfiguration.<locals>.initË  s   ø€ Ø�NŠNÐ.Ñ/Ô/Ð/Ð/Ð/r   rE   rF   )r¼   Ú__init__r   )TN)r	   rI   r¦   r   ÚCertificateOptionsr   rµ   Úpatchr
   r¬   r¨   rª   r«   ÚassertIs)r   r   r¼   Úfactoryr   r   r¯   r·   r‡   r¸   r½   s             @r   Útest_tlsConfigurationz,XMPPAuthenticatorTests.test_tlsConfigurationÄ  sè   ø€ ð
 ˆð	0ð 	0ð 	0ð 	0ð 	0ð 	0õ œ'Ð"=Ñ>Ô>ˆŒõ
 "Ô4Ñ6Ô6ÐÝÔ*ØŒO˜XÐ;Nð
ñ 
ô 
ˆð 	�
Š
•9Ô5°zÀ4ÑHÔHÐHØ×"Ò" 4Ñ(Ô(ˆð -/¬OÑ)ˆ��d˜D 'à×Ò˜c¥9Ô#EÑFÔFÐFØ�ŠÐ)¨7°1¬:Ñ6Ô6Ð6Ð6Ð6r   N)r*   r+   r,   rA   r±   r   ÚskipWhenNoSSLrÃ   r-   r   r   r³   r³   ž  sQ   € € € € € ðð ð+ð +ð +ðB €Vˆ]Ðð7ð 7ñ Ôð7ð 7ð 7r   r³   )"rA   Úhashlibr   r   r   Útwisted.internetr   Útwisted.trialÚtwisted.words.protocols.jabberr   r   r	   r
   Ú#twisted.words.protocols.jabber.saslr   Útwisted.words.xishr   r   rÄ   ÚImportErrorre   rX   rŠ   rŽ   Ú
NS_SESSIONrœ   ÚTestCaser   r/   rC   r‚   r–   r£   r³   r-   r   r   ú<module>rÎ      sw  ððð ð
 Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à "Ð "Ð "Ð "Ð "Ð "Ø "Ð "Ð "Ð "Ð "Ð "Ø HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HÐ HØ IÐ IÐ IÐ IÐ IÐ IØ &Ð &Ð &Ð &Ð &Ð &ð Ø$Ð$Ð$Ð$Ð$Ð$ð
  €M€Møð	 ð 0ð 0ð 0Ø
€CØ/€M€M€Mð0øøøð @€Ø?€Ø
,€Ø2°WÑ<€Ø2€
Ø8¸:ÑE€ð?ð ?ð ?ð ?ð ? 8Ô#4ñ ?ô ?ð ?ð,$ð $ð $ð $ð $ñ $ô $ð $ðND-ð D-ð D-ð D-ð D-Ð9¸8Ô;Lñ D-ô D-ð D-ðN+-ð +-ð +-ð +-ð +-Ð7¸Ô9Jñ +-ô +-ð +-ð\"-ð "-ð "-ð "-ð "-Ð:¸HÔ<Mñ "-ô "-ð "-ðJ"'ð "'ð "'ð "'ð "'˜hÔ/ñ "'ô "'ð "'ðJ@7ð @7ð @7ð @7ð @7˜XÔ.ñ @7ô @7ð @7ð @7ð @7s   ´= ½	A	ÁA	