403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/distutils/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/distutils/tests/__pycache__/test_upload.cpython-36.pyc
3

x2_��@s�dZddlZddlZddljZddlmZddlmZddl	m
Zddlm
Z
ddl
mZddlmZddlmZmZdd	lmZmZd
ZdZGdd
�d
e�ZGdd�de�Zdd�Zedkr�ee��dS)z#Tests for distutils.command.upload.�N)�	HTTPError)�run_unittest)�upload)�Distribution)�DistutilsError)�ERROR�INFO)�PYPIRC�BasePyPIRCCommandTestCasez�[distutils]

index-servers =
    server1
    server2

[server1]
username:me
password:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

[server2]
username:meagain
password: secret
realm:acme
repository:http://another.pypi/
z@[distutils]

index-servers =
    server1

[server1]
username:me
c@s0eZdZd
dd�Zddd�Zdd�Zdd	�ZdS)�FakeOpenNcCs6||_t|t�s||_nd|_|p$d|_|p.d|_dS)NZOK��)�url�
isinstance�str�req�msg�code)�selfr
rr�r�@/opt/alt/python36/lib64/python3.6/distutils/tests/test_upload.py�__init__0s

zFakeOpen.__init__cCsddij|j�|�S)Nzcontent-typeztext/plain; charset=utf-8)�get�lower)r�name�defaultrrr�	getheader9szFakeOpen.getheadercCsdS)Nsxyzzyr)rrrr�read>sz
FakeOpen.readcCs|jS)N)r)rrrr�getcodeAszFakeOpen.getcode)NN)N)�__name__�
__module__�__qualname__rrrrrrrrr.s
	
rcs`eZdZ�fdd�Z�fdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Z�ZS)�uploadTestCasecs4tt|�j�tj|_|jt_d|_d|_d|_	dS)N)
�superr!�setUp�
upload_mod�urlopen�old_open�_urlopen�	last_open�next_msg�	next_code)r)�	__class__rrr#GszuploadTestCase.setUpcs|jt_tt|�j�dS)N)r&r$r%r"r!�tearDown)r)r+rrr,OszuploadTestCase.tearDowncCst||j|jd�|_|jS)N)rr)rr)r*r()rr
rrrr'SszuploadTestCase._urlopencCsL|j|jt�t�}t|�}|j�x"d
D]\}}|jt||�|�q*WdS)N�username�me�password�secret�realm�pypi�
repository�https://upload.pypi.org/legacy/�r-r.�r/r0�r1r2�r3r4)r5r6r7r8)�
write_file�rcr	rr�finalize_options�assertEqual�getattr)r�dist�cmd�attrZwaitedrrr�test_finalize_optionsWsz$uploadTestCase.test_finalize_optionscCsZ|j|jt�t�}t|�}|j�|j|jd�d|_t|�}|j�|j|jd�dS)N�xxx)r9r:�PYPIRC_NOPASSWORDrrr;r<r/)rr>r?rrr�test_saved_passwordcsz"uploadTestCase.test_saved_passwordcCs.|j�}tjj|d�}|j|�dd|}}}|||fg}|j|jt�|j|d�\}}t|�}	d|	_	|	j
�|	j�t|j
jj�}
|j|
dd�|
d}|j|jd��|j|j
jj�d	�d
}|j|j
jj�|�|jd|j
jjk�|jd|j
jj�|jt�}
|j|
dd
ddd
d�dS)NrBz2.6)�
dist_files�zContent-lengthZ2162zContent-typezmultipart/form-dataZPOSTzhttps://upload.pypi.org/legacy/sxxxsprotocol_version�K�-z
xyzzy
���)�mkdtemp�os�path�joinr9r:�PYPIRC_LONG_PASSWORD�create_distr�
show_response�ensure_finalized�run�dictr(r�headersr<Z
assertTrue�
startswithZ
get_methodZget_full_url�data�assertIn�get_logsr)r�tmprL�command�	pyversion�filenamerE�pkg_dirr>r?rTZcontent_typeZexpected_url�resultsrrr�test_uploadts,

zuploadTestCase.test_uploadcCs�|j�}tjj|d�}|j|dd�dd|}}}|||fg}|j|jt�|j|dd�\}}t|�}	d|	_	|	j
�|	j�t|j
jj�}
|j|
dd	�|jd
|j
jj�dS)NrBzyy
)Zcontentz2.6zlong description
)rEZdescriptionrFzContent-lengthZ2172slong description
)rJrKrLrMr9r:rNrOrrPrQrRrSr(rrTr<rWrV)rrYrLrZr[r\rEr]r>r?rTrrr�test_upload_correct_cr�s z%uploadTestCase.test_upload_correct_crcCsd|_d|_|jt|j�dS)Nz	Not Foundi�)r)r*�assertRaisesrr_)rrrr�test_upload_fails�sz uploadTestCase.test_upload_failscCs|j�}tjj|d�}|j|�dd|fg}|j|jt�|j|d�\}}td�dtft	dddid�dt
fg}x�|D]�\}}}	|jt|�j
d	��xtjd
tj|d�d��V|j|	��t|�}
|
j�|
j�WdQRX|jt�}|j||d�|j�WdQRXWdQRXqtWdS)NrBz2.6)rEZoserrorr
i�Z	httperrorzUpload failed (400): httperror)�	exceptionz distutils.command.upload.urlopen)Zside_effect)�newrFrI)rJrKrLrMr9r:rNrO�OSErrorrrZsubTest�typer�mockZpatchZMockrarrQrRrXrrWZ
clear_logs)rrYrLrEr]r>ZtestsrcZexpectedZraised_exceptionr?r^rrr�test_wrong_exception_order�s(


z)uploadTestCase.test_wrong_exception_order)
rrr r#r,r'rArDr_r`rbrh�
__classcell__rr)r+rr!Es r!cCs
tjt�S)N)�unittestZ	makeSuiter!rrrr�
test_suite�srk�__main__)�__doc__rKrjZ
unittest.mockrgZurllib.requestrZtest.supportrZdistutils.commandrr$Zdistutils.command.uploadZdistutils.corerZdistutils.errorsrZ
distutils.logrrZdistutils.tests.test_configr	r
rNrC�objectrr!rkrrrrr�<module>s&


Youez - 2016 - github.com/yon3zu
LinuXploit