Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ 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 : |
o �b[; � @ s d Z zddlZW n ey dZY nw eZzddlZW n ey' dZY nw eZddlZddlmZ ddl m Z ddlmZm Z ddlmZ dZdd � Ze� ZG d d� d�ZG dd � d ee�ZG dd� dee�ZG dd� d�ZG dd� dee�ZG dd� dee�ZdS )z& Tests for L{twisted.python.fakepwd}. � N)�getitem)�_PYPY)�ShadowDatabase�UserDatabase)�TestCasei� c C s@ t } tdur zt�| � W n ty Y | S w | d8 } q| S )a� By convention, UIDs less than 1000 are reserved for the system. A system which allocated every single one of those UIDs would likely have practical problems with allocating new ones, so let's assume that we'll be able to find one. (If we don't, this will wrap around to negative values and I{eventually} find something.) @return: a user ID which does not exist on the local system. Or, on systems without a L{pwd} module, return C{SYSTEM_UID_MAX}. NT� )�SYSTEM_UID_MAX�pwd�getpwuid�KeyError)�guess� r �B/usr/lib/python3/dist-packages/twisted/python/test/test_fakepwd.py�findInvalidUID s ��r c @ sH e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dS )�UserDatabaseTestsMixina^ L{UserDatabaseTestsMixin} defines tests which apply to any user database implementation. Subclasses should mix it in, implement C{setUp} to create C{self.database} bound to a user database instance, and implement C{getExistingUserInfo} to return information about a user (such information should be unique per test method). c C s� t d�D ]D}| �� \}}}}}}}| j�|�} | �| j|� | �| j|� | �| j|� | �| j|� | �| j |� | �| j |� | �| j|� qdS )zc I{getpwuid} accepts a uid and returns the user record associated with it. � N)�range�getExistingUserInfo�databaser �assertEqual�pw_name� pw_passwd�pw_uid�pw_gid�pw_gecos�pw_dir�pw_shell� �self�i�username�password�uid�gid�gecos�dir�shell�entryr r r � test_getpwuidC � �z$UserDatabaseTestsMixin.test_getpwuidc C s | � t| jjt� dS )zu I{getpwuid} raises L{KeyError} when passed a uid which does not exist in the user database. N)�assertRaisesr r r �INVALID_UID�r r r r �test_noSuchUIDV � z%UserDatabaseTestsMixin.test_noSuchUIDc C s� t d�D ]D}| �� \}}}}}}}| j�|�} | �| j|� | �| j|� | �| j|� | �| j|� | �| j |� | �| j |� | �| j|� qdS )zh I{getpwnam} accepts a username and returns the user record associated with it. r N)r r r �getpwnamr r r r r r r r r r r r � test_getpwnam] r) z$UserDatabaseTestsMixin.test_getpwnamc C s"