a  ze4ã@s°ddlZddlZddlmZddlmZddlmZddlmZddlm Z ddl m Z dZ d Z d ZGd d „d e je je jejƒZGd d„deƒZdd„Zedkr¬e eƒƒdS)éN)Ú PyPIRCCommand)Ú Distribution)Ú set_threshold)ÚWARN)Úsupport)Ú run_unittestzÿ[distutils] index-servers = server1 server2 server3 [server1] username:me password:secret [server2] username:meagain password: secret realm:acme repository:http://another.pypi/ [server3] username:cbiggles password:yh^%#rest-of-my-password z.[server-login] username:tarek password:secret zI[distutils] index-servers = pypi [pypi] username:tarek password:xxx cs(eZdZ‡fdd„Z‡fdd„Z‡ZS)ÚBasePyPIRCCommandTestCasecsntt|ƒ ¡| ¡|_|jtjd<|jtjd<tj |jd¡|_ t ƒ|_ Gdd„dt ƒ}||_ ttƒ|_dS)NÚHOMEÚ USERPROFILEz.pypircc@s eZdZdd„Zdd„ZeZdS)z0BasePyPIRCCommandTestCase.setUp..commandcSst ||¡dS©N)rÚ__init__)ÚselfÚdist©rúO/opt/bitninja-python-dojo/embedded/lib/python3.9/distutils/tests/test_config.pyr Dsz9BasePyPIRCCommandTestCase.setUp..command.__init__cSsdSr r©r rrrÚinitialize_optionsFszCBasePyPIRCCommandTestCase.setUp..command.initialize_optionsN)Ú__name__Ú __module__Ú __qualname__r rZfinalize_optionsrrrrÚcommandCsr)ÚsuperrÚsetUpÚmkdtempZtmp_dirÚosÚenvironÚpathÚjoinÚrcrrrÚ_cmdrrÚ old_threshold)r r©Ú __class__rrr:s   zBasePyPIRCCommandTestCase.setUpcst|jƒtt|ƒ ¡dSr )rr rrÚtearDownrr!rrr#Ms z"BasePyPIRCCommandTestCase.tearDown)rrrrr#Ú __classcell__rrr!rr5s rc@s$eZdZdd„Zdd„Zdd„ZdS)ÚPyPIRCCommandTestCasecCs„| |jt¡| |j¡}| ¡}tt| ¡ƒƒ}gd¢}|  ||¡| |jt ¡| ¡}tt| ¡ƒƒ}gd¢}|  ||¡dS)N)©ÚpasswordZsecret©ZrealmZpypi©Ú repositoryzhttps://upload.pypi.org/legacy/)ÚserverZserver1)ÚusernameÚme)r&r(r))r+z server-login)r,Útarek) Ú write_filerÚPYPIRCrrÚ _read_pypircÚlistÚsortedÚitemsÚ assertEqualÚ PYPIRC_OLD©r ÚcmdZconfigZwaitedrrrÚtest_server_registrationUs  z.PyPIRCCommandTestCase.test_server_registrationcCs|| |j¡}| ¡}| tj |¡¡| dd¡| tj |¡¡t |ƒ}z |  ¡}|  |t ¡W|  ¡n |  ¡0dS)Nr.Zxxx)rrZ _get_rc_fileZ assertFalserrÚexistsZ _store_pypircZ assertTrueÚopenÚreadr5ÚWANTEDÚclose)r r8rÚfZcontentrrrÚtest_server_empty_registrationns  z4PyPIRCCommandTestCase.test_server_empty_registrationcCsP| |jt¡| |j¡}d|_| ¡}tt|  ¡ƒƒ}gd¢}|  ||¡dS)NÚserver3))r'zyh^%#rest-of-my-passwordr(r))r+rA)r,Zcbiggles) r/rr0rrr*r1r2r3r4r5r7rrrÚtest_config_interpolation{s z/PyPIRCCommandTestCase.test_config_interpolationN)rrrr9r@rBrrrrr%Ss r%cCs t t¡Sr )ÚunittestZ makeSuiter%rrrrÚ test_suite‰srDÚ__main__)rrCZdistutils.corerrZ distutils.logrrZdistutils.testsrZ test.supportrr0r6r=ZTempdirManagerZLoggingSilencerZ EnvironGuardZTestCaserr%rDrrrrrÚs&       ý6