��Qc@s9dZddlZddlZddlZddlZddlZddlmZmZddl m
Zddlm
Z
ddl
mZddlmZyddlZWnek
r�dZnXdZdZd efd
��YZdefd��YZd
efd��YZd�Zedkr5ee��ndS(s%Tests for distutils.command.register.i�N(tcheck_warningstrun_unittest(tregister(tDistutilsSetupError(tPyPIRCCommandTestCases@[distutils]
index-servers =
server1
[server1]
username:me
sN[distutils]
index-servers =
pypi
[pypi]
username:tarek
password:password
t RawInputscBs#eZdZd�Zdd�ZRS(sFakes user inputs.cGs||_d|_dS(Ni(tanswerstindex(tselfR((s3/sys/lib/python2.7/distutils/tests/test_register.pyt__init__,s tcCs)z|j|jSWd|jd7_XdS(Ni(RR(Rtprompt((s3/sys/lib/python2.7/distutils/tests/test_register.pyt__call__0s(t__name__t
__module__t__doc__R R(((s3/sys/lib/python2.7/distutils/tests/test_register.pyR*s t
FakeOpenercBs2eZdZd�Zd�Zd�Zd�ZRS(sFakes a PyPI servercCs
g|_dS(N(treqs(R((s3/sys/lib/python2.7/distutils/tests/test_register.pyR 8scGs|S(N((Rtargs((s3/sys/lib/python2.7/distutils/tests/test_register.pyR;scCs|jj|�|S(N(Rtappend(Rtreq((s3/sys/lib/python2.7/distutils/tests/test_register.pytopen>scCsdS(Ntxxx((R((s3/sys/lib/python2.7/distutils/tests/test_register.pytreadBs(R
RRR RRR(((s3/sys/lib/python2.7/distutils/tests/test_register.pyR6s
tRegisterTestCasecBs�eZd�Zd�Zdd�Zd�Zd�Zd�Zd�Z e
jedk d�d��Z
e
jedk d�d ��Zd
�ZRS(cCsTtt|�j�tj|_d�}|t_tj|_t�|_ t_dS(NcSsdS(Ntpassword((R((s3/sys/lib/python2.7/distutils/tests/test_register.pyt_getpassKs(
tsuperRtsetUptgetpasst_old_getpassturllib2tbuild_openert
old_openerRtconn(RR((s3/sys/lib/python2.7/distutils/tests/test_register.pyRGs cCs/|jt_|jt_tt|�j�dS(N(RRR!RR RRttearDown(R((s3/sys/lib/python2.7/distutils/tests/test_register.pyR#QscCsW|dkr8idd6dd6dd6dd6dd6}n|j|�\}}t|�S(NRturltauthortauthor_emailtnametversion(tNonetcreate_distR(Rtmetadatatpkg_infotdist((s3/sys/lib/python2.7/distutils/tests/test_register.pyt_get_cmdVscCsj|j�}|jtjj|j��tddd�}|jt_ z|j
�Wdt` X|jtjj|j��t|j�}z |j�}|j
|t�Wd|j�Xdd�}|t_ d|_|j
�|j
t|jj�d�t|jjdj�}t|jjdj�}|j
|d |d �|jd
|jjdjk�dS(Nt1ttarektyR
cSst|��dS(N(tAssertionError(R((s3/sys/lib/python2.7/distutils/tests/test_register.pyt_no_way�siiisContent-lengthR(R.t
assertTruetostpathtexiststrcRRtregister_modulet raw_inputtrunRRtassertEqualt
WANTED_PYPIRCtcloset
show_responsetlenR"Rtdicttheaderstdata(RtcmdtinputstftcontentR3treq1treq2((s3/sys/lib/python2.7/distutils/tests/test_register.pyttest_create_pypirc^s,
cCsW|j|jt�|j�}|j�|j�|j�|j|jj d�dS(NR(
t
write_fileR8tPYPIRC_NOPASSWORDR.t_set_configtfinalize_optionst
send_metadataR<tdistributionR(RRD((s3/sys/lib/python2.7/distutils/tests/test_register.pyttest_password_not_in_file�s
cCs�|j�}tddd�}|jt_z|j�Wdt`X|jt|jj �d�|jj d}t
|j�}|j|dd�|jd|j
k�dS(Nt2R0s[email protected]isContent-lengtht608(R.RRR9R:R;R<R@R"RRARBR4RC(RRDRERRB((s3/sys/lib/python2.7/distutils/tests/test_register.pyttest_registering�scCs�|j�}tdd�}|jt_z|j�Wdt`X|jt|jj �d�|jj d}t
|j�}|j|dd�|jd|j
k�dS(Nt3s[email protected]isContent-lengtht290R0(R.RRR9R:R;R<R@R"RRARBR4RC(RRDRERRB((s3/sys/lib/python2.7/distutils/tests/test_register.pyttest_password_reset�ssneeds docutilscCs�|ji�}|j�d|_|jt|j�idd6dd6dd6dd6dd6d d
6}|j|�}|j�d|_|jt|j�d|d
<|j|�}|j�d|_tdd
d�}|jt_ z|j�Wdt` X|j�}|j�tdd
d�}|jt_ z|j�Wdt` Xidd6dd6dd6dd6dd6dd6dd
6}|j|�}|j�d|_tdd
d�}|jt_ z|j�Wdt` XdS(NiRR$R%uéxéxéR&R'R(stitle
==
texttlong_descriptionstitle
=====
textR/R0R1uxxxuÉricunameuSomething about esszet ßtdescriptionuMore things about esszet ß(
R.tensure_finalizedtstricttassertRaisesRR;RRR9R:(RRDR+RE((s3/sys/lib/python2.7/distutils/tests/test_register.pyttest_strict�sR
cCs�d}idd6dd6dd6dd6dd6|d6}|j|�}|j�t|_td d
d�}|t_|jttd�|j t
|j�dS(
Ns
:funkie:`str`RR$R%R&R'R(RXRRR0s[email protected]:(R.RZtTrueR[RR9R:t
addCleanuptdelattrR\RR;(RRYR+RDRE((s3/sys/lib/python2.7/distutils/tests/test_register.pyt&test_register_invalid_long_descriptions
cCsR|j�}t��}tjd�|j�|jt|j�d�WdQXdS(Ntalwaysi(R.Rtwarningstsimplefiltertcheck_metadataR<R@(RRDtw((s3/sys/lib/python2.7/distutils/tests/test_register.pyttest_check_metadata_deprecateds
N(R
RRR#R)R.RJRQRTRWtunittestt
skipUnlesstdocutilsR]RaRg(((s3/sys/lib/python2.7/distutils/tests/test_register.pyREs
7 !B!cCs
tjt�S(N(Rht makeSuiteR(((s3/sys/lib/python2.7/distutils/tests/test_register.pyt
test_suitest__main__(RR5RhRRRcttest.test_supportRRtdistutils.commandRR9tdistutils.command.registertdistutils.errorsRtdistutils.tests.test_configRRjtImportErrorR)RLR=tobjectRRRRlR
(((s3/sys/lib/python2.7/distutils/tests/test_register.pyt<module>s,
�
|