m 0Ec@sdZdkZdkZdkZdkZdkZdklZdkl Z dkl Z dkl Z dkl Z dkl Z dklZd klZd klZd klZd klZd fdYZdefdYZeidZdZeidZdZdZdZedZdfdYZ de fdYZ!ddZ#dZ$ddZ%dZ&d d!d"d#gZ'dS($sXSupport for (functional) doc tests $Id: functional.py 69935 2006-09-02 15:50:57Z shh $ N(sdoctest(s ZopeTestCase(sFunctionalTestCase(s Functional(s folder_name(s user_name(s user_password(s user_role(sstandard_permissions(s AppZapper(sResponseWrappertHTTPHeaderOutputcBs5tZdZdZdZdZdZRS(NcCs(h|_g|_||_||_dS(N(tselftheaderstheadersltprotocoltomit(RRR((tJ/data/zmath/zope/lib/python/Testing/ZopeTestCase/zopedoctest/functional.pyt__init__(s   cCs|||_|_dS(N(tstatustreasonR(RRR ((RtsetResponseStatus.sc Cs|iitg}|iD]f\}}|i |i joD|di g}|i dD]}||iq\~|fqq~dS(Nt-(RRtupdatetdictt_[1]tmappingtitemstnametvtlowerRtjoint_[2]tsplittst capitalize(RRRRRRR((RtsetResponseHeaders1sc Csg}|D]}|t|q ~}|iig}|D]f\}}|i |i joD|di g}|idD]}||iqz~|fq;q;~dS(NR (Rtlsttheadert split_headerRRRtextendRRRRRRRRR( RRRRRRRRR((RtappendResponseHeaders8s'cCsg}|iiD]}|d|q~}|ig}|iD]}|d|qB~|i|i dd|i |i |i fdi |S(Ns%s: %sis%s %s %ss (RRRRRtoutRRtsorttinsertRRR R(RRRR((Rt__str__@s ./ &(t__name__t __module__RR RRR"(((RR$s     tDocResponseWrappercBs tZdZdZdZRS(s)Response Wrapper for use in doctests cCs#ti||||||_dS(N(tResponseWrapperRRtresponset outstreamtpatht header_output(RR'R(R)R*((RRLscCs3|i}|od|i|fSnd|iS(Ns%s %ss%s (RtgetBodytbodyR*(RR,((RR"Ps (R#R$t__doc__RR"(((RR%Hs  s (\S+): (.+)$cCsti|iddS(Nii(theaderretmatchRtgroup(R((RRXssBasic (.+)?:(.+)?$cCsti|}|oxdk}|idd\}}|djo d}n|djo d}n|id||f}d|d Sn|S(Niits%s:%ssBasic %si( tbasicreR/Rtbase64R0tutptNonet encodestringtauth(RR5R3R4R8R/((Rt auth_header\s     cCs tiS(N(t AppZappertapp(((Rt getRootFolderjscCstiidS(N(R<t_p_jartsync(((RR>msc Csdk} dk} dkl}dkl}dkl}dkl }dkl }|}t i |i}|id}|| i}||d}|i\} }}| i|}||}hd d <d d <d | <d |<} |id}t|djo|d| dR%(R`RrRRRYR\RReR(RRR*RiRfRSR)R'RRUR[R]RcRnRWRR5Rh((Rthttpqsb           * 3     tZopeSuiteFactorycBs>tZdZdZdZdZdZdZRS(NcOs=||_||_d|_|i|i|i dS(N( targsRt_argstkwt_kwR6t_layert setup_globstsetup_test_classtsetup_optionflags(RRzR|((RRs      cCs<ti|i|i}|idj o|i|_n|S(N( tdoctestt DocTestSuiteRR{R}tsuiteR~R6tlayer(RR((Rt doctestsuitescCs<ti|i|i}|idj o|i|_n|S(N( Rt DocFileSuiteRR{R}RR~R6R(RR((Rt docfilesuitescCsK|iidh}t|ds%s:%st user_auth( RyRRR}RRRxR<R>R3R7RR(RR((RRs     cCs|iidt}t|tpS|i}t i dt dd|jod|}nt |t|fh}n||idRRxRyRR6RRRRt__all__( R:RR>RyRRRRR3RRRR%RxRR.RRR2RqRRRRR^RRR&RRR9R<((RRDs<             $     YQ"