Current File : //opt/imh-python/lib/python2.7/test/test_cgi.pyc
�
��Wc@s�ddlmZmZddlZddlZddlZddlZddlZddlm	Z	dfd��YZ
e
�e_yddlmZWn!e
k
r�ddlmZnXdfd��YZd	�Zd
ed�fded�fd
ed�fded�fded�fdifdifdifdidgd
6fded�fded�fded�fdidgd6fdidgd6fdidgd6fdidgd6fd ed�fd!ed"�fd#id$gd6d%gd6fd&id$d'gd6fd(id)gd*6d+gd,6d-gd.6fd/id)gd*6d+gd,6d-gd.6fd0id)gd*6d+gd,6d-gd.6fd1id2gd36d4gd56d6gd76d8gd96d:gd;6d<gd=6d>gd?6d@gdA6fdBidCgdD6dEgdF6dGgdH6d)gdI6dJgdK6dLgdM6fgZdN�ZdO�ZdP�ZdQejfdR��YZdS�ZedTkr�e�ndS(Ui����(trun_unittesttcheck_warningsN(t
namedtupletHackedSysModulecBseZgZejZRS((t__name__t
__module__targvtsyststdin(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyR
s(tStringIOtComparableExceptioncBs,eZd�Zd�Zd�Zd�ZRS(cCs
||_dS(N(terr(tselfR((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyt__init__scCs
t|j�S(N(tstrR(R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyt__str__scCsQt|t�sdSt|jj|j�}|dkr;|St|jj|j�S(Ni����i(t
isinstancet	ExceptiontcmpRt	__class__targs(RtanExctx((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyt__cmp__scCst|j|�S(N(tgetattrR(Rtattr((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyt__getattr__&s(RRR
RRR(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyR
s			cCs�i}|dkr/d}d|d<||d<nR|dkrtt|�}d|d<d|d<tt|��|d<n
td|�ytj||d	d
�SWntk
r�}t|�SXdS(NtGETtREQUEST_METHODtQUERY_STRINGtPOSTs!application/x-www-form-urlencodedtCONTENT_TYPEtCONTENT_LENGTHsunknown method: %ststrict_parsingi(	tNoneR	Rtlent
ValueErrortcgitparset
StandardErrorR
(tbuftmethodtenvtfpR((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pytdo_test)s




tsbad query field: ''t&s&&t;s;&;t=s=&=s=;=s=atas&=as=a&s=&asbad query field: 'a'sb=atbsb+=asb sa=b=asa=+b=as b=as&b=asb&=asbad query field: 'b'sa=a+b&b=b+csa bsb csa=a+b&a=b+asb asx=1&y=2.0&z=2-3.%2b0t1Rs2.0tys2-3.+0tzsx=1;y=2.0&z=2-3.%2b0sx=1;y=2.0;z=2-3.%2b0s�Hbc5161168c542333633315dee1182227:key_store_seqid=400006&cuyer=r&view=bustomer&order_id=0bb2e248638833d48cb7fed300000f1b&expire=964546263&lobale=en-US&kid=130003.300038&ss=envt400006s1Hbc5161168c542333633315dee1182227:key_store_seqidtrtcuyert	964546263texpires
130003.300038tkidsen-UStlobalet 0bb2e248638833d48cb7fed300000f1btorder_idR*tsstbustomertviewsQgroup_id=5470&set=custom&_assigned_to=31392&_status=1&_category=100&SUBMIT=BrowsetBrowsetSUBMITt31392t_assigned_tot100t	_categoryt_statust5470tgroup_idtcustomtsetcCstd�|�S(NcSs|dS(Ni((R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyt<lambda>ks(tmap(tlist((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyt
first_eltsjscCstd�|�S(NcSs|d|ddfS(Nii((tp((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyRMns(RN(RO((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pytfirst_second_eltsmscCs�t|�}|jd�tjd|d|�}i}xKt|�j�D]7\}}t|t�rt|j|�pz|j	||<qJW|S(NiR+tenviron(
R	tseekR%tFieldStoragetdicttitemsRROtgetlisttvalue(tdataRSt
fake_stdintformtresulttktv((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyt
gen_resultps
/tCgiTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	idd	6d
dgd6d
d6dd6Z
d�Zd�Zd�Z
d�Zd�Zd�ZRS(cCsR|jdtjd��|jdtjd��|jdtjdt��dS(Nstest &amp; strings
test & strings&lt;test string&gt;s
<test string>s&quot;test string&quot;s
"test string"(tassertEqualR%tescapetTrue(R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttest_escape}scCs4x-tD]%\}}t|d�}|j||dt|��t|d�}|j||dt|��i|d6}tj|�}tj|�}tjd|�}t|t	�r|jt
|�t
|��|j|j�|j��|j|j
�|j
��|j|j�|j��|j|jdd�d�|jt
|�t
|��|j|j�|j��|j|jdd�d�x�|j�D]�}||}	|j|j|��|j||||�|j|j|d�||�|j|j|��t
|	�dkr3d	}
nd}
y||}Wn7tk
r�|j|
�|j|j|�|	�n?X|j|
�|j||	d	�|j|j|�|	d	�|j|j|�|	�|
r�|j|j
�t|j
���|j|j�t|j���q�q�WqqWdS(
NRsError parsing %sRRRSsnonexistent fieldtdefaultii(tparse_strict_test_casesR,RbtreprR%tFormContentDicttSvFormContentDictRURRVR#tassertItemsEqualtkeystvaluesRWtgettgetvaluet
assertTruethas_keyt
IndexErrortassertFalseRXRPRR(RtorigtexpecttdR*tfcdtsdtfstkeyt
expect_valtsingle_valuetval((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttest_strict�sR

 	


cCs�idd6}idd6dd6dd6d	d
6}tj|�}x.|j�D] \}}|j|||�qKWx.|j�D] \}}|j|||�q|W|j|j�|j��dS(Nsx=1&y=2.0&z=2-3.%2b0&1=1abcRiRg@R4s2-3.+0R5t1abcR3(R%tInterpFormContentDictRWRbRkRm(RR*RuRvR^R_((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttest_weird_formcontentdict�s
"cCs�tjd�t�t_tjdd�tjdd�|jtjj�d�tjj	d�r�dt_dt_tjdd�tjd�ndS(	NtTestings%ssTesting initlog 1s
Testing log 2s Testing initlog 1
Testing log 2
s	/dev/nulls
Testing log 3s
Testing log 4(R%tlogR	tlogfptinitlogRbRotostpathtexistsR"tlogfile(R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttest_log�s
		cCs�ddd��Y}|tj��}|jddd�|jd�idd6}tjd	|d
|�}|j|jd�dS(
NtTestReadlineFilecBs&eZd�Zdd�Zd�ZRS(cSs||_d|_dS(Ni(tfiletnumcalls(RR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyR
�s	cSs6|jd7_|r%|jj|�S|jj�SdS(Ni(R�R�treadline(Rtsize((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyR��scSsB|jd}t||�}t|t�s>t|||�n|S(NR�(t__dict__RRtinttsetattr(RtnameR�R1((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyR�s

N(RRR
R"R�R(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyR��s	RiiitPUTRR+RSi((ttempfilet
TemporaryFiletwriteRTR%RUt
assertGreaterR�(RR�tfR*Ry((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttest_fieldstorage_readline�s

cCs�tj�}|j|�|jtt|��|jt|�t|j���|jj	t
dd�d��|j|�dS(NtMockFieldStorageR�t
fieldvalue(R%RURstassertRaisest	TypeErrortboolRbRORltappendRRp(RRy((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttest_fieldstorage_invalid�s
"c	Cs)idd6dd6dd6}d}tjdt|�d	|�}|jt|j�d
�idd6dd
6dd6idd6dd
6dd6idd6dd
6dd6idd6dd
6dd6g}xdtt|j��D]M}xD||j�D]2\}}t	|j||�}|j||�q�Wq�WdS(NRRsTmultipart/form-data; boundary=---------------------------721837373350705526688164684Rt558R s-----------------------------721837373350705526688164684
Content-Disposition: form-data; name="id"

1234
-----------------------------721837373350705526688164684
Content-Disposition: form-data; name="title"


-----------------------------721837373350705526688164684
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain

Testing 123.

-----------------------------721837373350705526688164684
Content-Disposition: form-data; name="submit"

 Add 
-----------------------------721837373350705526688164684--
R+RSitidR�tfilenamet1234RYttitleR-R�stest.txts
Testing 123.
tsubmits Add (
R%RUR	RbR#ROR"trangeRWR(	RR*tpostdataRyRuRR^texptgot((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttest_fieldstorage_multipart�scsld}d�_�fd�}|d|d�|d|dd�|d|ddd|d�dS(Niicsadjdd�|}itt|��d6dd6dd6}�jt||�i|d	6�dS(
Nsq
---123
Content-Disposition: form-data; name="upload"; filename="fake.txt"
Content-Type: text/plain

%s
---123--
s
s
R s"multipart/form-data; boundary=-123RRRtupload(treplaceRR#RbR`(tcontentRZRS(R(sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pytchecks
Rs
R4i(R"tmaxDiff(RtmaxlineR�((Rsf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyt#test_fieldstorage_multipart_maxlines	tvalue1tkey1tvalue2xtvalue2ytkey2tvalue3tkey3tvalue4tkey4cCsZd}itt|��d6dd6dd6dd6}t||�}|j|j|�dS(	Ns$key2=value2x&key3=value3&key4=value4R s!application/x-www-form-urlencodedRskey1=value1&key2=value2yRRR(RR#R`Rbt
_qs_result(RRZRSR_((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttestQSAndUrlEncode4s
cCsZd}itt|��d6dd6dd6dd6}t||�}|j|j|�dS(	Ns�
---123
Content-Disposition: form-data; name="key2"

value2y
---123
Content-Disposition: form-data; name="key3"

value3
---123
Content-Disposition: form-data; name="key4"

value4
---123--
R s"multipart/form-data; boundary=-123Rskey1=value1&key2=value2xRRR(RR#R`RbR�(RRZRSR_((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttestQSAndFormData?s
cCszd}itt|��d6dd6dd6dd6}|jj�}|jid	d
6�t||�}|j||�dS(NsF
---123
Content-Disposition: form-data; name="key2"

value2y
---123
Content-Disposition: form-data; name="key3"

value3
---123
Content-Disposition: form-data; name="key4"

value4
---123
Content-Disposition: form-data; name="upload"; filename="fake.txt"
Content-Type: text/plain

this is the content of the fake file

---123--
R s"multipart/form-data; boundary=-123Rskey1=value1&key2=value2xRRRs%this is the content of the fake file
R�(RR#R�tcopytupdateR`Rb(RRZRSR]R_((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttestQSAndFormDataFileXs
	cCsTtdtf��<|jidgd6dgd6dgd6tjd��WdQXdS(	Ns9cgi.parse_qs is deprecated, use urlparse.parse_qs insteadtA1R1tB3tBtB2R2sa=A1&b=B2&B=B3(RtPendingDeprecationWarningRbR%tparse_qs(R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttest_deprecated_parse_qs{s
'c	Cs?tdtf��'|jd	d
dgtjd��WdQXdS(Ns;cgi.parse_qsl is deprecated, use urlparse.parse_qsl insteadR1R�R2R�R�R�sa=A1&b=B2&B=B3(R1sA1(R2sB2(R�sB3(RR�RbR%t	parse_qsl(R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttest_deprecated_parse_qsl�s
cCsa|jtjd�dif�|jtjd�dif�|jtjd�didd6f�|jtjd�didd6f�|jtjd�didd6d	d
6f�|jtjd�did
d6f�|jtjd�didd6f�|jtjd�didd6dd6f�|jtjd�didd6dd6f�dS(Ns
text/plainstext/vnd.just.made.this.up ; stext/vnd.just.made.this.upstext/plain;charset=us-asciisus-asciitcharsetstext/plain ; charset="us-ascii"s,text/plain ; charset="us-ascii"; another=opttopttanothers attachment; filename="silly.txt"t
attachments	silly.txtR�s#attachment; filename="strange;name"sstrange;names-attachment; filename="strange;name";size=123;t123R�s-form-data; name="files"; filename="fo\"o;bar"s	form-datatfilesR�sfo"o;bar(RbR%tparse_header(R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyttest_parse_header�s6

(RRReR~R�R�R�R�R�R�R�R�R�R�R�R�R�(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyRa{s&		1		
	"		"	

			#		cCstt�dS(N(RRa(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyt	test_main�st__main__(ttest.test_supportRRR%R�RR�tunittesttcollectionsRRt	cStringIOR	tImportErrorR
R,R$RgRPRRR`tTestCaseRaR�R(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_cgi.pyt<module>sz
				'''












			�-