
    <eW                        d dl Z d dlZd dlmZ d dlZ ej                    5   ej        de            ej        d          Z	ddd           n# 1 swxY w Y    ej
         ee d          o e j                    d k    d           G d dej                              Z ej
         ee d          o e j                    d k    d	           G d
 dej                              Zedk    r ej                     dS dS )    N)import_helperignorespwdgeteuidzroot privileges requiredc                       e Zd Zd Zd ZdS )TestSpwdRootc                     t                                           }|                     |t                     |D ]"}|                     |t           j                   #d S )N)r   getspallassertIsInstanceliststruct_spwd)selfentriesentrys      %/usr/lib/python3.11/test/test_spwd.pytest_getspallzTestSpwdRoot.test_getspall   sZ    --//gt,,, 	; 	;E!!%)9::::	; 	;    c                 `   t                                           }|s|                     d           |d         j        }t                               |          }|                     |t           j                   |                     |j        |           |                     |j        |d                    |                     |j        |j                   |                     |j	        t                     |                     |j	        |d                    |                     |j	        |j                   |                     |j        t                     |                     |j        |d                    |                     |j        t                     |                     |j        |d                    |                     |j        t                     |                     |j        |d                    |                     |j        t                     |                     |j        |d                    |                     |j        t                     |                     |j        |d                    |                     |j        t                     |                     |j        |d	                    |                     |j        t                     |                     |j        |d
                    |                     t*                    5 }t                               d           d d d            n# 1 swxY w Y   |                     t          |j                  d           |                     t.          t           j                   |                     t.          t           j        d           |                     t.          t           j        |d           	 t1          j        |          }|                     t.          t           j        |           d S # t4          $ r Y d S w xY w)Nzempty shadow password databaser                           zinvalid user namez'getspnam(): name not found')r   r
   skipTestsp_nampgetspnamr   r   assertEqualsp_namsp_pwdpstrsp_pwd	sp_lstchgintsp_minsp_maxsp_warnsp_inact	sp_expiresp_flagassertRaisesKeyError	exception	TypeErrorosfsencodeUnicodeEncodeError)r   r   random_namer   cx
bytes_names         r   test_getspnamzTestSpwdRoot.test_getspnam   s   --// 	<MM:;;;aj(k**eT%5666444a111555emS111a111555eos333%(333elC000uQx000elC000uQx000emS111a111enc222q222eos333%(333emS111a111x(( 	/BMM-...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/R\**,JKKK)T]333)T]A666)T]KCCC	D[11J i
CCCCC " 	 	 	DD	s$   L==MM#P 
P-,P-N)__name__
__module____qualname__r   r7    r   r   r   r      s7        ; ; ;&D &D &D &D &Dr   r   znon-root user requiredc                       e Zd Zd ZdS )TestSpwdNonRootc                    d}	 |                      t                    5 }t                              |           d d d            d S # 1 swxY w Y   d S # t          $ r&}|                     d|d|           Y d }~d S d }~ww xY w)Nbinzspwd entry z doesn't exist: )r-   PermissionErrorr   r   r.   r   )r   namecmexcs       r   test_getspnam_exceptionz'TestSpwdNonRoot.test_getspnam_exceptionC   s    	K""?33 $rd###$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ 	K 	K 	KMMMtttSSIJJJJJJJJJ	Ks9   A AA A

A A
A 
BA>>BN)r8   r9   r:   rD   r;   r   r   r=   r=   ?   s(        K K K K Kr   r=   __main__)r1   unittesttest.supportr   warningscatch_warningssimplefilterDeprecationWarningimport_moduler   
skipUnlesshasattrr   TestCaser   r=   r8   mainr;   r   r   <module>rQ      s   				  & & & & & &  X / /H($6777&=&v..D/ / / / / / / / / / / / / / /
 WWR++A

0A/1 1.D .D .D .D .D8$ .D .D1 1.Db WWR++A

0A-/ /K K K K Kh' K K/ /K zHMOOOOO s   "AAA