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/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/test/__pycache__/test_factories.cpython-310.pyc
o

�b��@sVdZddlZddlmZmZddlmZddlmZGdd�d�Z	Gdd	�d	e�Z
dS)
z&
Test code for basic Factory classes.
�N)�Protocol�ReconnectingClientFactory)�Clock)�TestCasec@s eZdZdZdd�Zdd�ZdS)�
FakeConnectorzP
    A fake connector class, to be used to mock connections failed or lost.
    cC�dS�N���selfr	r	�=/usr/lib/python3/dist-packages/twisted/test/test_factories.py�stopConnecting�zFakeConnector.stopConnectingcCrrr	r
r	r	r�connectrzFakeConnector.connectN)�__name__�
__module__�__qualname__�__doc__r
rr	r	r	rrsrc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�ReconnectingFactoryTestsz1
    Tests for L{ReconnectingClientFactory}.
    cCsJGdd�d�}t�}t|_|�d�|��|�|�d�|�|j�dS)z�
        If a L{ReconnectingClientFactory} has C{stopTrying} called while it is
        connected, it does not subsequently attempt to reconnect if the
        connection is later lost.
        c@seZdZdd�Zdd�ZdS)zQReconnectingFactoryTests.test_stopTryingWhenConnected.<locals>.NoConnectConnectorcS�td��)Nz%Shouldn't be called, we're connected.��RuntimeErrorr
r	r	rr
)�z`ReconnectingFactoryTests.test_stopTryingWhenConnected.<locals>.NoConnectConnector.stopConnectingcSr)NzShouldn't be reconnecting.rr
r	r	rr,rzYReconnectingFactoryTests.test_stopTryingWhenConnected.<locals>.NoConnectConnector.connectN)rrrr
rr	r	r	r�NoConnectConnector(srN)rr�protocol�
buildProtocol�
stopTrying�clientConnectionLost�assertFalse�continueTrying)rr�cr	r	r�test_stopTryingWhenConnected!s
z5ReconnectingFactoryTests.test_stopTryingWhenConnectedcsTG�fdd�dt�}t��t��_|��_���|��jj�|��j���dS)z
        Calling stopTrying on a L{ReconnectingClientFactory} doesn't attempt a
        retry on any active connector.
        cs$eZdZdZ�fdd�Zdd�ZdS)z[ReconnectingFactoryTests.test_stopTryingDoesNotReconnect.<locals>.FactoryAwareFakeConnectorFcs��|d�dS)z�
                Behave as though an ongoing connection attempt has now
                failed, and notify the factory of this.
                N)�clientConnectionFailedr
��fr	rr
AszjReconnectingFactoryTests.test_stopTryingDoesNotReconnect.<locals>.FactoryAwareFakeConnector.stopConnectingcSs
d|_dS)z|
                Record an attempt to reconnect, since this is what we
                are trying to avoid.
                TN)�attemptedRetryr
r	r	rrHs
zcReconnectingFactoryTests.test_stopTryingDoesNotReconnect.<locals>.FactoryAwareFakeConnector.connectN)rrrr%r
rr	r#r	r�FactoryAwareFakeConnector>sr&N)	rrr�clock�	connectorrrr%�getDelayedCalls)rr&r	r#r�test_stopTryingDoesNotReconnect8sz8ReconnectingFactoryTests.test_stopTryingDoesNotReconnectcCs*t�}t�t�|��}|�|j|j�dS)z�
        A L{ReconnectingClientFactory} which hasn't been used for anything
        can be pickled and unpickled and end up with the same state.
        N)r�pickle�loads�dumps�assertEqual�__dict__)r�original�
reconstitutedr	r	r�test_serializeUnused[sz-ReconnectingFactoryTests.test_serializeUnusedcCs2t�}t�}||_t�t�|��}|�|j�dS)z�
        The clock attribute of L{ReconnectingClientFactory} is not serialized,
        and the restored value sets it to the default value, the reactor.
        N)rrr'r+r,r-�assertIsNone)rr'r0r1r	r	r�test_serializeWithClockds
z0ReconnectingFactoryTests.test_serializeWithClockcCszt�}|�t�d�|�|j�t�|�}t�|�}|�|j	�|�|j
�|�|jd�|�|j
|j�|�|j�dS)z�
        A L{ReconnectingClientFactory} which is unpickled does not have an
        L{IConnector} and has its reconnecting timing parameters reset to their
        initial values.
        Nr)rr"r�
addCleanuprr+r-r,r3r(�_callIDr.�retries�delay�initialDelay�
assertTruer)r�factory�
serialized�unserializedr	r	r�$test_deserializationResetsParametersos

z=ReconnectingFactoryTests.test_deserializationResetsParameterscCs6t�}t�}||_|�t�d�|�t|j�d�dS)z�
        The clock used by L{ReconnectingClientFactory} can be parametrized, so
        that one can cleanly test reconnections.
        N�)rrr'rrr.�len�calls)rr'r;r	r	r�test_parametrizedClock�s
z/ReconnectingFactoryTests.test_parametrizedClockN)
rrrrr!r*r2r4r>rBr	r	r	rrs#	r)rr+�twisted.internet.protocolrr�twisted.internet.taskr�twisted.trial.unittestrrrr	r	r	r�<module>s

Anon7 - 2022
AnonSec Team