AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/twisted/words/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/twisted/words/test/__pycache__/test_jabbererror.cpython-310.pyc
o

�bQ,�@s�dZddlmZddlmZddlmZdZdZdZ	dZ
Gd	d
�d
ej�ZGdd�dej�Z
Gd
d�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZdS)z4
Tests for L{twisted.words.protocols.jabber.error}.
�)�unittest)�error)�domishz$http://www.w3.org/XML/1998/namespace� http://etherx.jabber.org/streamsz#urn:ietf:params:xml:ns:xmpp-streamsz#urn:ietf:params:xml:ns:xmpp-stanzasc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�BaseErrorTestscCs6t�d�}|��}|�|jd�|�t|j�d�dS)z<
        Test getting an element for a plain error.
        �feature-not-implementedN�)r�	BaseError�
getElement�assertIdentical�uri�assertEqual�len�children��self�e�element�r�E/usr/lib/python3/dist-packages/twisted/words/test/test_jabbererror.py�test_getElementPlains
z#BaseErrorTests.test_getElementPlaincCsTt�dd�}|��}|�t|j�d�|�t|j�d�|�|j�t	df�d�dS)zC
        Test getting an element for an error with a text.
        r�text��langN)
rr	r
r
rr�strr�getAttribute�NS_XMLrrrr�test_getElementTexts
z"BaseErrorTests.test_getElementTextcCsTt�ddd�}|��}|�t|j�d�|�t|j�d�|�|jtdfd�dS)zP
        Test getting an element for an error with a text and language.
        rr�en_USrrN)	rr	r
r
rrrrrrrrr�test_getElementTextLang's
z&BaseErrorTests.test_getElementTextLangcCsDt�d�}tjd|d�}|��}|�t|j�d�|�|j|�dS)zV
        Test getting an element for an error with an app specific condition.
        )�testns�myerrorr)�appConditionrN)	r�Elementrr	r
r
rrr!)r�acrrrrr�test_getElementAppCondition1s

z*BaseErrorTests.test_getElementAppConditionN)�__name__�
__module__�__qualname__rrrr%rrrrrs
	

rc@s$eZdZdd�Zdd�Zdd�ZdS)�StreamErrorTestscCs$t�d�}|��}|�|jt�dS)zK
        Test namespace of the element representation of an error.
        rN)r�StreamErrorr
r
r�
NS_STREAMSrrrrr=s
z%StreamErrorTests.test_getElementPlaincC�*t�d�}|��}|�tt|d�j�dS�zR
        Test that the error condition element has the correct namespace.
        rN)rr*r
r
�NS_XMPP_STREAMS�getattrrrrrr�!test_getElementConditionNamespaceE�

�z2StreamErrorTests.test_getElementConditionNamespacecCs(t�dd�}|��}|�t|jj�dS)�M
        Test that the error text element has the correct namespace.
        rrN)rr*r
r
r.rrrrrr�test_getElementTextNamespaceOsz-StreamErrorTests.test_getElementTextNamespaceN)r&r'r(rr0r3rrrrr)<s
r)c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�StanzaErrorTestsz)
    Tests for L{error.StreamError}.
    cCs*t�d�}|�d|j�|�d|j�dS)zI
        Remote Server Timeout should yield type wait, code 504.
        zremote-server-timeout�wait�504N)r�StanzaErrorr
�type�code)rrrrr�test_typeRemoteServerTimeout]s
z-StanzaErrorTests.test_typeRemoteServerTimeoutcCsDt�d�}|��}|�|jd�|�|dd�|�|dd�dS)zC
        Test getting an element for a plain stanza error.
        rNr8�cancelr9�501�rr7r
r
rrrrrres

z%StanzaErrorTests.test_getElementPlaincCsFt�dd�}|��}|�|jd�|�|dd�|�|dd�dS)zO
        Test getting an element for a stanza error with a given type.
        r�authNr8r9r<r=rrrr�test_getElementTypeos
z$StanzaErrorTests.test_getElementTypecCr,r-)rr7r
r
�NS_XMPP_STANZASr/rrrrrr0yr1z2StanzaErrorTests.test_getElementConditionNamespacecCs*tjddd�}|��}|�t|jj�dS)r2rr)rN)rr7r
r
r@rrrrrrr3�sz-StanzaErrorTests.test_getElementTextNamespacecCs�t�d�}d|d<d|d<d|d<t�d�}|�|�}|�||�|�|dd�|�|dd�|�|dd	�|�|jjd
jd�|�|jdd�|�	|j|j�dS)
z�
        Test an error response is generated from a stanza.

        The addressing on the (new) response stanza should be reversed, an
        error child (with proper properties) added and the type set to
        C{'error'}.
        )z
jabber:client�message�chatr8zuser1@example.com�tozuser2@example.com/resource�from�service-unavailablerrr;N)
rr#rr7�
toResponse�assertNotIdenticalr
r�name�assertNotEqual)r�stanzar�responserrr�test_toResponse�s


z StanzaErrorTests.test_toResponseN)
r&r'r(�__doc__r:rr?r0r3rLrrrrr4Xs


r4c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�ParseErrorTestsz)
    Tests for L{error._parseError}.
    cCst�d�|_dS)N)Nr)rr#r)rrrr�setUp�szParseErrorTests.setUpcCs(t�|jd�}|�ddddd�|�dS)z:
        Test parsing of the empty error element.
        �errornsN)�	conditionr�textLangr")r�_parseErrorr
�r�resultrrr�
test_empty�s
�zParseErrorTests.test_emptycCs.|j�d�t�|jd�}|�d|d�dS)zD
        Test parsing of an error element with a condition.
        )rP�bad-requestrPrWrQN�r�
addElementrSr
rTrrr�test_condition��zParseErrorTests.test_conditioncCsH|j�d�}|�d�t�|jd�}|�d|d�|�d|d�dS)z?
        Test parsing of an error element with a text.
        �rPr�testrPrNrR)rrY�
addContentrSr
�rrrUrrr�	test_text�s

zParseErrorTests.test_textcCsD|j�d�}d|tdf<|�d�t�|jd�}|�d|d�dS)zW
        Test parsing of an error element with a text with a defined language.
        r\rrr]rPrRN)rrYrr^rSr
r_rrr�
test_textLang�s

zParseErrorTests.test_textLangcCs.|j�d�}t�|jd�}|�||d�dS)zR
        Test parsing of an error element with an app specific condition.
        �r rQrPr"NrX�rrQrUrrr�test_appCondition�r[z!ParseErrorTests.test_appConditioncCs:|j�d�|j�d�}t�|jd�}|�||d�dS)zY
        Test parsing of an error element with multiple app specific conditions.
        rb)r �
condition2rPr"NrXrcrrr�test_appConditionMultiple�sz)ParseErrorTests.test_appConditionMultipleN)r&r'r(rMrOrVrZr`rardrfrrrrrN�s


rNc@seZdZdd�Zdd�ZdS)�ExceptionFromStanzaTestscCs�t�d�}|�d�}|�d�|�d�}d|d<|�tdf�|�d�}d	|d
<t�|�}|�|tj�|�d|j	�|�d|j
�|�||j�|�|g|j�dS)a�
        Test basic operations of exceptionFromStanza.

        Given a realistic stanza, check if a sane exception is returned.

        Using this stanza::

          <iq type='error'
              from='pubsub.shakespeare.lit'
              to='francisco@denmark.lit/barracks'
              id='subscriptions1'>
            <pubsub xmlns='http://jabber.org/protocol/pubsub'>
              <subscriptions/>
            </pubsub>
            <error type='cancel'>
              <feature-not-implemented
                xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
              <unsupported xmlns='http://jabber.org/protocol/pubsub#errors'
                           feature='retrieve-subscriptions'/>
            </error>
          </iq>
        �NrJ)z!http://jabber.org/protocol/pubsub�pubsub�
subscriptionsrr;r8r)z(http://jabber.org/protocol/pubsub#errors�unsupportedzretrieve-subscriptions�featureN)
rr#rYr@r�exceptionFromStanza�assertIsInstancer7r
rQr8r"r)rrJ�pr�ucrUrrr�
test_basic�s





z#ExceptionFromStanzaTests.test_basiccCs�t�d�}|jddd�}|jddd�}d|d<t�|�}|�|tj�|�d	|j�|�d
|j	�|�d|j
�|�|g|j�dS)a�
        Test legacy operations of exceptionFromStanza.

        Given a realistic stanza with only legacy (pre-XMPP) error information,
        check if a sane exception is returned.

        Using this stanza::

          <message type='error'
                   to='piers@pipetree.com/Home'
                   from='qmacro@jaber.org'>
            <body>Are you there?</body>
            <error code='502'>Unable to resolve hostname.</error>
          </message>
        rh�bodyzAre you there?)�contentrzUnable to resolve hostname.�502r9rEr5N)rr#rYrrmrnr7r
rQr8rr)rrJrorrUrrr�test_legacys

z$ExceptionFromStanzaTests.test_legacyN)r&r'r(rqrurrrrrg�s(rgc@seZdZdd�ZdS)�ExceptionFromStreamErrorTestscCsBt�d�}|�tdf�t�|�}|�|tj�|�d|j	�dS)ac
        Test basic operations of exceptionFromStreamError.

        Given a realistic stream error, check if a sane exception is returned.

        Using this error::

          <stream:error xmlns:stream='http://etherx.jabber.org/streams'>
            <xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
          </stream:error>
        )rrzxml-not-well-formedN)
rr#rYr.r�exceptionFromStreamErrorrnr*r
rQ)rrrUrrrrq)s



z(ExceptionFromStreamErrorTests.test_basicN)r&r'r(rqrrrrrv(srvN)rM�
twisted.trialr�twisted.words.protocols.jabberr�twisted.words.xishrrr+r.r@�TestCaserr)r4rNrgrvrrrr�<module>s)J@F

Anon7 - 2022
AnonSec Team