��Qc@s�dZddlZddlZddlmZddlmZddlmZddl m
Z
ddlmZm
Z
dZdZd efd
��YZde
fd��YZd
�Zedkr�ee��ndS(s#Tests for distutils.command.upload.i�N(trun_unittest(tupload(tDistribution(tPYPIRCtPyPIRCCommandTestCases�[distutils]
index-servers =
server1
server2
[server1]
username:me
password:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
[server2]
username:meagain
password: secret
realm:acme
repository:http://another.pypi/
s@[distutils]
index-servers =
server1
[server1]
username:me
tFakeOpencBseZd�Zd�ZRS(cCs:||_t|t�s$||_n d|_d|_dS(NtOK(turlt
isinstancetstrtreqtNonetmsg(tselfR((s1/sys/lib/python2.7/distutils/tests/test_upload.pyt__init__,s
cCsdS(Ni�((R
((s1/sys/lib/python2.7/distutils/tests/test_upload.pytgetcode4s(t__name__t
__module__RR(((s1/sys/lib/python2.7/distutils/tests/test_upload.pyR*s tuploadTestCasecBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs8tt|�j�tj|_|jt_d|_dS(N( tsuperRtsetUpt
upload_modturlopentold_opent_urlopenRt last_open(R
((s1/sys/lib/python2.7/distutils/tests/test_upload.pyR:scCs#|jt_tt|�j�dS(N(RRRRRttearDown(R
((s1/sys/lib/python2.7/distutils/tests/test_upload.pyR@scCst|�|_|jS(N(RR(R
R((s1/sys/lib/python2.7/distutils/tests/test_upload.pyRDscCsr|j|jt�t�}t|�}|j�x9d d
ddfD]%\}}|jt||�|�qEWdS(
Ntusernametmetpasswordtsecrettrealmtpypit
repositoryshttp://pypi.python.org/pypi(RR(spasswordR(RR (R!shttp://pypi.python.org/pypi(t
write_filetrcRRRtfinalize_optionstassertEqualtgetattr(R
tdisttcmdtattrtwaited((s1/sys/lib/python2.7/distutils/tests/test_upload.pyttest_finalize_optionsHs
cCs{|j|jt�t�}t|�}|j�|j|jd�d|_t|�}|j�|j|jd�dS(Ntxxx( R"R#tPYPIRC_NOPASSWORDRRR$R%RR(R
R'R(((s1/sys/lib/python2.7/distutils/tests/test_upload.pyttest_saved_passwordTs
cCs|j�}tjj|d�}|j|�dd|}}}|||fg}|j|jt�|jd|dd�\}}t|�} | j �| j
�|jd|jj
j�t|jj
j�}
|j|
dd�|j|
d jd
��|j|jj
j�d�|j|jj
j�d�|jd|jj
jk�|jj
jd
}|jd|k�dS(NR,s2.6t
dist_filestauthorudédésdédésContent-lengtht2085sContent-typesmultipart/form-datatPOSTshttp://pypi.python.org/pypit
Authorizations
(tmkdtemptostpathtjoinR"R#tPYPIRC_LONG_PASSWORDtcreate_distRtensure_finalizedtruntassertInRR
tdatatdicttheadersR%t
assertTruet
startswitht
get_methodtget_full_urltassertFalse(R
ttmpR6tcommandt pyversiontfilenameR/tpkg_dirR'R(R?tauth((s1/sys/lib/python2.7/distutils/tests/test_upload.pyttest_uploades(
(RRRRRR+R.RK(((s1/sys/lib/python2.7/distutils/tests/test_upload.pyR8s cCs
tjt�S(N(tunittestt makeSuiteR(((s1/sys/lib/python2.7/distutils/tests/test_upload.pyt
test_suitest__main__(t__doc__R5RLttest.test_supportRtdistutils.commandRRtdistutils.command.uploadtdistutils.coreRtdistutils.tests.test_configRRR8R-tobjectRRRNR(((s1/sys/lib/python2.7/distutils/tests/test_upload.pyt<module>sG
|