Your IP : 216.73.216.213


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/test_spwd.cpython-39.pyc

a

XC?h�
�@s�ddlZddlZddlmZe�d�Ze�eed�o>e��dkd�Gdd�dej	��Z
e�eed�one��dkd�Gd	d
�d
ej	��Zedkr�e�
�dS)�N)�support�spwd�geteuidzroot privileges requiredc@seZdZdd�Zdd�ZdS)�TestSpwdRootcCs0t��}|�|t�|D]}|�|tj�qdS)N)r�getspall�assertIsInstance�list�struct_spwd)�self�entries�entry�r
�3/opt/alt/python39/lib64/python3.9/test/test_spwd.py�
test_getspallszTestSpwdRoot.test_getspallcCs(t��}|s|�d�|dj}t�|�}|�|tj�|�|j|�|�|j|d�|�|j|j�|�|j	t
�|�|j	|d�|�|j	|j�|�|jt
�|�|j|d�|�|jt
�|�|j|d�|�|jt
�|�|j|d�|�|jt
�|�|j|d�|�|jt
�|�|j|d�|�|jt
�|�|j|d	�|�|jt
�|�|j|d
�|�t��}t�d�Wd�n1�s�0Y|�t
|j�d�|�ttj�|�ttjd�|�ttj|d�zt�|�}Wnt�yYn0|�ttj|�dS)
Nzempty shadow password databaser��������zinvalid user namez'getspnam(): name not found')rr�skipTestZsp_namp�getspnamrr	ZassertEqualZsp_namZsp_pwdp�strZsp_pwdZ	sp_lstchg�intZsp_minZsp_maxZsp_warnZsp_inactZ	sp_expireZsp_flag�assertRaises�KeyErrorZ	exception�	TypeError�os�fsencode�UnicodeEncodeError)r
rZrandom_namerZcxZ
bytes_namer
r
r�
test_getspnamsJ


*zTestSpwdRoot.test_getspnamN)�__name__�
__module__�__qualname__rr"r
r
r
rrsrznon-root user requiredc@seZdZdd�ZdS)�TestSpwdNonRootc
Csxd}z8|�t��}t�|�Wd�n1s00YWn6tyr}z|�d||f�WYd}~n
d}~00dS)N�binzspwd entry %r doesn't exist: %s)r�PermissionErrorrrrr)r
�name�cm�excr
r
r�test_getspnam_exception?s,z'TestSpwdNonRoot.test_getspnam_exceptionN)r#r$r%r,r
r
r
rr&;sr&�__main__)rZunittest�testr�
import_modulerZ
skipUnless�hasattrrZTestCaserr&r#�mainr
r
r
r�<module>s
�1�