Ñò
ÍDÀLc           @   sÙ   d  Z  d d k Z d d k Z d d k Z d d k l Z d d k l Z d d k l Z d d k l	 Z	 d d k
 l Z d Z d	 Z d
 Z d e i e i f d „  ƒ  YZ d „  Z e d j o e i d d ƒ n d S(   s"   Tests for distutils.pypirc.pypirc.iÿÿÿÿN(   t   PyPIRCCommand(   t   Distribution(   t   set_threshold(   t   WARN(   t   supports´   [distutils]

index-servers =
    server1
    server2

[server1]
username:me
password:secret

[server2]
username:meagain
password: secret
realm:acme
repository:http://another.pypi/
s.   [server-login]
username:tarek
password:secret
sI   [distutils]
index-servers =
    pypi

[pypi]
username:tarek
password:xxx
t   PyPIRCCommandTestCasec           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s²   t  t |  ƒ i ƒ  t i i d ƒ o t i d |  _ n
 d |  _ |  i ƒ  } | t i d <t i	 i
 | d ƒ |  _ t ƒ  |  _ d t f d „  ƒ  Y} | |  _ t t ƒ |  _ d S(   s   Patches the environment.t   HOMEs   .pypirct   commandc           B   s    e  Z d  „  Z d „  Z e Z RS(   c         S   s   t  i |  | ƒ d  S(   N(   R    t   __init__(   t   selft   dist(    (    s1   scripts/common/Lib/distutils/tests/test_config.pyR   ?   s    c         S   s   d  S(   N(    (   R	   (    (    s1   scripts/common/Lib/distutils/tests/test_config.pyt   initialize_optionsA   s    (   t   __name__t
   __module__R   R   t   finalize_options(    (    (    s1   scripts/common/Lib/distutils/tests/test_config.pyR   >   s   		N(   t   superR   t   setUpt   ost   environt   has_keyt	   _old_homet   Nonet   mkdtempt   patht   joint   rcR   R
   R    t   _cmdR   R   t   old_threshold(   R	   t   tempdirR   (    (    s1   scripts/common/Lib/distutils/tests/test_config.pyR   2   s    		c         C   sR   |  i  d j o t i d =n |  i  t i d <t |  i ƒ t t |  ƒ i ƒ  d S(   s   Removes the patch.R   N(	   R   R   R   R   R   R   R   R   t   tearDown(   R	   (    (    s1   scripts/common/Lib/distutils/tests/test_config.pyR   H   s
    c      	   C   sþ   t  |  i d ƒ } z | i t ƒ Wd  | i ƒ  X|  i |  i ƒ } | i ƒ  } | i ƒ  } | i	 ƒ  d d d d d g } |  i
 | | ƒ t  |  i d ƒ } | i t ƒ | i ƒ  | i ƒ  } | i ƒ  } | i	 ƒ  d d d d d g } |  i
 | | ƒ d  S(   Nt   wt   passwordt   secrett   realmt   pypit
   repositorys   http://pypi.python.org/pypit   servert   server1t   usernamet   mes   server-logint   tarek(   R   R    (   R!   R"   (   R#   s   http://pypi.python.org/pypi(   R$   R%   (   R&   R'   (   R   R    (   R!   R"   (   R#   s   http://pypi.python.org/pypi(   R$   s   server-login(   R&   R(   (   t   openR   t   writet   PYPIRCt   closeR   R
   t   _read_pypirct   itemst   sortt   assertEqualst
   PYPIRC_OLD(   R	   t   ft   cmdt   configt   waited(    (    s1   scripts/common/Lib/distutils/tests/test_config.pyt   test_server_registrationQ   s,    


c         C   s‡   |  i  |  i ƒ } | i ƒ  } |  i t i i | ƒ ƒ | i d d ƒ |  i t i i | ƒ ƒ t | ƒ i	 ƒ  } |  i
 | t ƒ d  S(   NR(   t   xxx(   R   R
   t   _get_rc_filet   assert_R   R   t   existst   _store_pypircR)   t   readR0   t   WANTED(   R	   R3   R   t   content(    (    s1   scripts/common/Lib/distutils/tests/test_config.pyt   test_server_empty_registrationt   s    (   R   R   R   R   R6   R?   (    (    (    s1   scripts/common/Lib/distutils/tests/test_config.pyR   0   s   				#c           C   s   t  i t ƒ S(   N(   t   unittestt	   makeSuiteR   (    (    (    s1   scripts/common/Lib/distutils/tests/test_config.pyt
   test_suite‚   s    t   __main__t   defaultTestRB   (   t   __doc__t   sysR   R@   t   distutils.coreR    R   t   distutils.logR   R   t   distutils.testsR   R+   R1   R=   t   TempdirManagert   TestCaseR   RB   R   t   main(    (    (    s1   scripts/common/Lib/distutils/tests/test_config.pyt   <module>   s   
R	