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 :  /usr/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 : /usr/lib/python3/dist-packages/twisted/words/test/__pycache__/test_xmlstream.cpython-310.pyc
o

�b��@s�dZddlmZddlmZddlmZddlmZm	Z	m
Z
Gdd�dej�ZGdd	�d	ej
e	j�ZGd
d�dej�ZGdd
�d
e�ZGdd�de�ZdS)z,
Tests for L{twisted.words.xish.xmlstream}.
�)�protocol)�failure)�unittest)�domish�utility�	xmlstreamc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�XmlStreamTestscCs0d|_g|_t��|_||j_|jj|jj_dS)Nz	no reason)�connectionLostMsg�outlistr�	XmlStream�	transport�append�write��self�r�C/usr/lib/python3/dist-packages/twisted/words/test/test_xmlstream.py�setUps

zXmlStreamTests.setUpcCs|j�t�t|j���dS)zA
        Stub loseConnection because we are a transport.
        N)r�connectionLostr�Failure�	Exceptionr	rrrr�loseConnections�zXmlStreamTests.loseConnectioncCs,|j��|j�d�|�|jdd�dS)zq
        Calling L{xmlstream.XmlStream.send} results in the data being written
        to the transport.
        s<root>rN)r�connectionMade�send�assertEqualr
rrrr�	test_sends
zXmlStreamTests.test_sendcsJg��fdd�}|j�tj|�|j��|j�d�|�dt���dS)zU
        Receiving the starttag of the root element results in stream start.
        c���d�dS�N�r
)�rootelem��
streamStartedrr�streamStartEvent.�z9XmlStreamTests.test_receiveRoot.<locals>.streamStartEvent�<root>�N)r�addObserver�STREAM_START_EVENTr�dataReceivedr�len)rr"rr r�test_receiveRoot(s
zXmlStreamTests.test_receiveRootcs�g�g��fdd�}�fdd�}|j�tj|�|j�tj|�|j��|j�d�|�dt���|�dt���|j�d�|�dt���|��d�	t
j��|�dt���d	S)
zN
        Receiving malformed XML results in an L{STREAM_ERROR_EVENT}.
        c���|�dSrr��reason)�streamErrorrr�streamErrorEvent=r#z;XmlStreamTests.test_receiveBadXML.<locals>.streamErrorEventcrrr)�_��	streamEndrr�streamEndEvent@r#z9XmlStreamTests.test_receiveBadXML.<locals>.streamEndEventr$rz<child><unclosed></child>r%N)rr&�STREAM_ERROR_EVENT�STREAM_END_EVENTrr(rr)�
assertTrue�checkr�ParserError)rr/r3r)r2r.r�test_receiveBadXML6s
z!XmlStreamTests.test_receiveBadXMLcsng��fdd�}|j�tj|�|j��|��|�dt���|��dtj	�|��d�
�|j�dS)z@
        Ending the stream fires a L{STREAM_END_EVENT}.
        cr+rrr,r1rrr3Vr#z5XmlStreamTests.test_streamEnd.<locals>.streamEndEventr%rN)rr&r5rrrr)�assertIsInstancerr�getErrorMessager	)rr3rr1r�test_streamEndPs
zXmlStreamTests.test_streamEndN)	�__name__�
__module__�__qualname__rrrr*r9r<rrrrrs	rc@seZdZdZdd�ZdS)�
DummyProtocolz�
    I am a protocol with an event dispatcher without further processing.

    This protocol is only used for testing XmlStreamFactoryMixin to make
    sure the bootstrap observers are added to the protocol instance.
    cOs"||_||_g|_tj�|�dSr)�args�kwargs�	observersr�EventDispatcher�__init__)rrArBrrrrEiszDummyProtocol.__init__N)r=r>r?�__doc__rErrrrr@asr@c@�(eZdZdZdd�Zdd�Zdd�ZdS)	�BootstrapMixinTestszq
    Tests for L{xmlstream.BootstrapMixin}.

    @ivar factory: Instance of the factory or mixin under test.
    cC�t��|_dSr)r�BootstrapMixin�factoryrrrrrxr#zBootstrapMixinTests.setUpcsPg��fdd�}t�}|j�d|�|j�|�|�dd�|�dt���dS)zL
        Dispatching an event fires registered bootstrap observers.
        cr+rr��data��calledrr�cb�r#z6BootstrapMixinTests.test_installBootstraps.<locals>.cb�//event/myeventNr%)r@rK�addBootstrap�installBootstraps�dispatchrr)�rrP�
dispatcherrrNr�test_installBootstraps{sz*BootstrapMixinTests.test_installBootstrapscsXg��fdd�}|j�d|�|j�d|�t�}|j�|�|�dd�|���dS)zI
        Test addition and removal of a bootstrap event handler.
        cr+rrrLrNrrrP�r#z:BootstrapMixinTests.test_addAndRemoveBootstrap.<locals>.cbrQN)rKrR�removeBootstrapr@rSrT�assertFalserUrrNr�test_addAndRemoveBootstrap�sz.BootstrapMixinTests.test_addAndRemoveBootstrapN)r=r>r?rFrrWrZrrrrrHqs
rHc@rG)	�!GenericXmlStreamFactoryTestsMixinz3
    Generic tests for L{XmlStream} factories.
    cCrIr)r�XmlStreamFactoryrKrrrrr�r#z'GenericXmlStreamFactoryTestsMixin.setUpcsJg��fdd�}|j�d|�|j�d�}|�dd�|�dt���dS)zY
        The protocol factory installs bootstrap event handlers on the protocol.
        cr+rrrLrNrrrP�r#zRGenericXmlStreamFactoryTestsMixin.test_buildProtocolInstallsBootstraps.<locals>.cbrQNr%)rKrR�
buildProtocolrTrr))rrP�xsrrNr�$test_buildProtocolInstallsBootstraps�szFGenericXmlStreamFactoryTestsMixin.test_buildProtocolInstallsBootstrapscCs |j�d�}|�|j|j�dS)z@
        The protocol factory is saved in the protocol.
        N)rKr]�assertIdentical�rr^rrr�test_buildProtocolStoresFactory�szAGenericXmlStreamFactoryTestsMixin.test_buildProtocolStoresFactoryN)r=r>r?rFrr_rbrrrrr[�s
r[c@s eZdZdZdd�Zdd�ZdS)�XmlStreamFactoryMixinTestsz7
    Tests for L{xmlstream.XmlStreamFactoryMixin}.
    cCstjddd�|_t|j_dS)N)�test)r�XmlStreamFactoryMixinrKr@rrrrrr�sz XmlStreamFactoryMixinTests.setUpcCs0|j�d�}|�d|j�|�ddi|j�dS)zb
        Arguments passed to the factory are passed to protocol on
        instantiation.
        Nrrd)rKr]rrArBrarrr�"test_buildProtocolFactoryArguments�sz=XmlStreamFactoryMixinTests.test_buildProtocolFactoryArgumentsN)r=r>r?rFrrfrrrrrc�srcN)rF�twisted.internetr�twisted.pythonr�
twisted.trialr�twisted.words.xishrrr�TestCaser�ProtocolrDr@rHr[rcrrrr�<module>sR. 

Anon7 - 2022
AnonSec Team