ó {G_Tc@s‘ddlZddlZddlZddlZddlZddlmZejZdej fd„ƒYZ d„Z e dkre ƒndS(iÿÿÿÿN(t test_supportt NetrcTestCasecBs­eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Z d „Z d „Z d „Z d „Z d „Zd„Zejejdkdƒd„ƒZRS(cCsvtj|ƒ}d}tjdkr1|d7}ntt|ƒ}|j|ƒWdQX|jtj tƒt j tƒS(Ntwtcygwintt( ttextwraptdedenttsystplatformtopent temp_filenametwritet addCleanuptostunlinktnetrc(tselft test_datatmodetfp((s+/usr/local/lib/python2.7/test/test_netrc.pytmake_nrcs cCsA|jdƒ}|j|jdd ƒ|j|jdd ƒdS( Ns‡ machine host1.domain.com login log1 password pass1 account acct1 default login log2 password pass2 shost1.domain.comtlog1tacct1tpass1tdefaulttlog2tpass2(RRR(RNR(Rt assertEqualthoststNone(Rtnrc((s+/usr/local/lib/python2.7/test/test_netrc.pyt test_defaults  cCs@|jdƒ}|j|jiddgd6ddgd6ƒdS(Ns‰ macdef macro1 line1 line2 macdef macro2 line3 line4 sline1 sline2 tmacro1sline3 sline4 tmacro2(RRtmacros(RR((s+/usr/local/lib/python2.7/test/test_netrc.pyt test_macross cCs3|j|ƒ}|j|jddd|fƒdS(Nshost.domain.comtlogtacct(RRR(RRtpasswd((s+/usr/local/lib/python2.7/test/test_netrc.pyt_test_passwords(scCs|jddƒdS(NsV machine host.domain.com login log password #pass account acct s#pass(R'(R((s+/usr/local/lib/python2.7/test/test_netrc.pyttest_password_with_leading_hash,scCs|jddƒdS(NsV machine host.domain.com login log password pass# account acct spass#(R'(R((s+/usr/local/lib/python2.7/test/test_netrc.pyt test_password_with_trailing_hash1scCs|jddƒdS(NsV machine host.domain.com login log password pa#ss account acct spa#ss(R'(R((s+/usr/local/lib/python2.7/test/test_netrc.pyt test_password_with_internal_hash6stpasscCsJ|j|ƒ}|j|jddd|fƒ|j|jddƒdS(Nsfoo.domain.comtbarsbar.domain.comtfooR+(R-NR+(RRRR(RRR&((s+/usr/local/lib/python2.7/test/test_netrc.pyt _test_comment;s cCs|jdƒdS(Ns˜ # comment machine foo.domain.com login bar password pass machine bar.domain.com login foo password pass (R.(R((s+/usr/local/lib/python2.7/test/test_netrc.pyt test_comment_before_machine_line@scCs|jdƒdS(Ns— #comment machine foo.domain.com login bar password pass machine bar.domain.com login foo password pass (R.(R((s+/usr/local/lib/python2.7/test/test_netrc.pyt)test_comment_before_machine_line_no_spaceGscCs|jdƒdS(Ns # machine foo.domain.com login bar password pass machine bar.domain.com login foo password pass (R.(R((s+/usr/local/lib/python2.7/test/test_netrc.pyt*test_comment_before_machine_line_hash_onlyNscCs|jdƒdS(NsŒ machine foo.domain.com login bar password pass # comment machine bar.domain.com login foo password pass (R.(R((s+/usr/local/lib/python2.7/test/test_netrc.pyt#test_comment_at_end_of_machine_lineUscCs|jdƒdS(Ns‹ machine foo.domain.com login bar password pass #comment machine bar.domain.com login foo password pass (R.(R((s+/usr/local/lib/python2.7/test/test_netrc.pyt,test_comment_at_end_of_machine_line_no_space[scCs|jddƒdS(NsŒ machine foo.domain.com login bar password #pass #comment machine bar.domain.com login foo password pass s#pass(R.(R((s+/usr/local/lib/python2.7/test/test_netrc.pyt1test_comment_at_end_of_machine_line_pass_has_hashastposixsPOSIX only testc Csåtj}tj|ƒ|jtj|ƒtjj|dƒ}t|dƒ}|j dƒWdQXtj ƒp}|j d|ƒtj |dƒt j ƒ}|j|jdd ƒtj |d ƒ|jt jt j ƒWdQXdS( Ns.netrctwts machine foo.domain.com login bar password pass default login foo password pass tHOMEi€sfoo.domain.comR,R+i’(sbarNspass(RtTESTFNR tmkdirR trmtreetpathtjoinR R tEnvironmentVarGuardtsettchmodRRRRt assertRaisestNetrcParseError(RtdtfntftenvironR((s+/usr/local/lib/python2.7/test/test_netrc.pyt test_securityhs    (t__name__t __module__RRR#R'R(R)R*R.R/R0R1R2R3R4tunittestt skipUnlessR tnameRF(((s+/usr/local/lib/python2.7/test/test_netrc.pyRs           cCstjtƒdS(N(Rt run_unittestR(((s+/usr/local/lib/python2.7/test/test_netrc.pyt test_main~st__main__( RR RIRRttestRR8R tTestCaseRRMRG(((s+/usr/local/lib/python2.7/test/test_netrc.pyts < x