{G_Tc@sddlZddlZddlmZejdZejeedo[ejdkddej fdYZ d Z e d kre ndS( iN(t test_supporttspwdtgeteuidisroot privileges requiredt TestSpwdRootcBseZdZdZRS(cCsDtj}|j|tx!|D]}|j|tjq#WdS(N(RtgetspalltassertIsInstancetlistt struct_spwd(tselftentriestentry((s*/usr/local/lib/python2.7/test/test_spwd.pyt test_getspall s  cCstj}|s"|jdn|dj}tj|}|j|tj|j|j||j|j|d|j|jt |j|j|d|j|j t |j|j |d|j|j t |j|j |d|j|j t |j|j |d|j|jt |j|j|d|j|jt |j|j|d|j|jt |j|j|d |j|jt |j|j|d |jt}tjd WdQX|jt |jd |jttj|jttjd|jttj|dtjryt|}Wntk rwqX|jtj||ndS( Nsempty shadow password databaseiiiiiiiiisinvalid user names'getspnam(): name not found'(RRtskipTesttsp_namtgetspnamRRt assertEqualtsp_pwdtstrt sp_lstchgtinttsp_mintsp_maxtsp_warntsp_inactt sp_expiretsp_flagt assertRaisestKeyErrort exceptiont TypeErrorRt have_unicodetunicodetUnicodeDecodeError(RR t random_nameR tcxt unicode_name((s*/usr/local/lib/python2.7/test/test_spwd.pyt test_getspnamsH    (t__name__t __module__R R$(((s*/usr/local/lib/python2.7/test/test_spwd.pyRs cCstjtdS(N(Rt run_unittestR(((s*/usr/local/lib/python2.7/test/test_spwd.pyt test_main:st__main__( tostunittestttestRt import_moduleRt skipUnlessthasattrRtTestCaseRR(R%(((s*/usr/local/lib/python2.7/test/test_spwd.pyts  $ 0