Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_netrc.cpython-38.opt-2.pyc
U

>��g��@sbddlZddlZddlZddlZddlZddlZddlmZGdd�dej�Z	e
dkr^e��dS)�N)�supportc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	d)dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Ze�ejdkd�d d!��Zd"d#�Zd$d%�Zd&d'�Zd(S)*�
NetrcTestCasec	Csht�|�}d}tjdkr |d7}t��\}}tj||d��}|�|�W5QRX|�	tj
|�t�|�S)N�w�cygwin�t)�mode)�textwrap�dedent�sys�platform�tempfile�mkstemp�os�fdopen�write�
addCleanup�unlink�netrc)�selfZ	test_datarZtemp_fdZ
temp_filename�fp�r�./opt/cppython/lib/python3.8/test/test_netrc.py�make_nrcs

zNetrcTestCase.make_nrccCsP|�d�}|�|jdd�|�|jdd�|�|���}|�|j|j�dS)Nz�            machine host1.domain.com login log1 password pass1 account acct1
            default login log2 password pass2
            zhost1.domain.com)Zlog1Zacct1Zpass1�default)�log2NZpass2)r�assertEqual�hosts�__repr__)r�nrcZnrc2rrr�test_defaults
�zNetrcTestCase.test_defaultcCs*|�d�}|�|jddgddgd��dS)Nz�            macdef macro1
            line1
            line2

            macdef macro2
            line3
            line4
            zline1
zline2
zline3
zline4
)Zmacro1Zmacro2)rrZmacros)rrrrr�test_macross
	�zNetrcTestCase.test_macroscCs&|�|�}|�|jddd|f�dS)Nzhost.domain.com�logZacct�rrr�rrZpasswdrrr�_test_passwords+s
zNetrcTestCase._test_passwordscCs|�dd�dS)NzV            machine host.domain.com login log password #pass account acct
            �#pass�r$�rrrr�test_password_with_leading_hash/s�z-NetrcTestCase.test_password_with_leading_hashcCs|�dd�dS)NzV            machine host.domain.com login log password pass# account acct
            zpass#r&r'rrr� test_password_with_trailing_hash4s�z.NetrcTestCase.test_password_with_trailing_hashcCs|�dd�dS)NzV            machine host.domain.com login log password pa#ss account acct
            zpa#ssr&r'rrr� test_password_with_internal_hash9s�z.NetrcTestCase.test_password_with_internal_hash�passcCs8|�|�}|�|jddd|f�|�|jdd�dS)N�foo.domain.com�barzbar.domain.com)ZfooNr+r"r#rrr�
_test_comment>s
zNetrcTestCase._test_commentcCs|�d�dS)Nz�            # comment
            machine foo.domain.com login bar password pass
            machine bar.domain.com login foo password pass
            �r.r'rrr� test_comment_before_machine_lineCsz.NetrcTestCase.test_comment_before_machine_linecCs|�d�dS)Nz�            #comment
            machine foo.domain.com login bar password pass
            machine bar.domain.com login foo password pass
            r/r'rrr�)test_comment_before_machine_line_no_spaceJsz7NetrcTestCase.test_comment_before_machine_line_no_spacecCs|�d�dS)Nz�            #
            machine foo.domain.com login bar password pass
            machine bar.domain.com login foo password pass
            r/r'rrr�*test_comment_before_machine_line_hash_onlyQsz8NetrcTestCase.test_comment_before_machine_line_hash_onlycCs|�d�dS)Nz�            machine foo.domain.com login bar password pass # comment
            machine bar.domain.com login foo password pass
            r/r'rrr�#test_comment_at_end_of_machine_lineXsz1NetrcTestCase.test_comment_at_end_of_machine_linecCs|�d�dS)Nz�            machine foo.domain.com login bar password pass #comment
            machine bar.domain.com login foo password pass
            r/r'rrr�,test_comment_at_end_of_machine_line_no_space^sz:NetrcTestCase.test_comment_at_end_of_machine_line_no_spacecCs|�dd�dS)Nz�            machine foo.domain.com login bar password #pass #comment
            machine bar.domain.com login foo password pass
            r%r/r'rrr�1test_comment_at_end_of_machine_line_pass_has_hashds�z?NetrcTestCase.test_comment_at_end_of_machine_line_pass_has_hash�posixzPOSIX only testc	Cs�tj}t�|�|�tj|�tj�|d�}t|d��}|�	d�W5QRXt�
��T}|�d|�t�|d�t
�
�}|�|jdd�t�|d�|�t
jt
j
�W5QRXdS)	N�.netrcZwtz                machine foo.domain.com login bar password pass
                default login foo password pass
                �HOME�r,)r-Nr+i�)r�TESTFNr�mkdirr�rmtree�path�join�openr�EnvironmentVarGuard�set�chmodrrr�assertRaisesZNetrcParseError)r�d�fn�f�environrrrr�
test_securityks

�zNetrcTestCase.test_securityc	CsPtj}t�|�|�tj|�t��� }|�d|�|�t	t
j
�W5QRXdS)Nr8)rr:rr;rr<r@rArC�FileNotFoundErrorr)rrDrGrrr�test_file_not_found_in_home�s

z)NetrcTestCase.test_file_not_found_in_homecCs|jttjdd�dS)NZunlikely_netrc)�file)rCrIrr'rrr�test_file_not_found_explicit�s
�z*NetrcTestCase.test_file_not_found_explicitc	s�tj�t���|�tj��tj��d�}t|d��}|�	d�W5QRXt�
|d�tjj�g����fdd�}t�tjd|��*t
�
�}|�d�\}}}|�|d	�W5QRX|���dS)
Nr7rz.machine foo.domain.com login bar password passr9c
sN��|�t���2}|�d��|�d���|�}|W5QR�SQRXdS)Nr8ZUSERPROFILE)�appendrr@rA)�srG�result�ZcalledZ	fake_homeZorig_expanduserrr�fake_expanduser�s

z8NetrcTestCase.test_home_not_set.<locals>.fake_expanduser�
expanduserr,r-)rr:rr;rr<r=r>r?rrBrRZ	swap_attrrZauthenticatorsrZ
assertTrue)rZfake_netrc_pathrFrQrZloginZaccountZpasswordrrPr�test_home_not_set�s
zNetrcTestCase.test_home_not_setN)r+)�__name__�
__module__�__qualname__rrr r$r(r)r*r.r0r1r2r3r4r5�unittestZ
skipUnlessr�namerHrJrLrSrrrrrs&


r�__main__)rrrWr
rr�testrZTestCaserrT�mainrrrr�<module>s
0%

F1le Man4ger