+
    Tj                         ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHtHt ^ RIHtHtHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHt ^ RIHtHt ^ RIH t  ^ RI!H"t"H#t#H$t$ ^ RI%H&t& ^ RI'H(t(H)t)H*t*H+t+ ^ RI,H-t- ^ RI.H/t/ ^ RI0H1t1 ^ RI2H3t3 ^ RI4H5t5 ^ RI6H7t7 ^ RI8H9t9 R5t:Rt;R];,          t<]9! R 4      t=]9! R!4      t>]?! ]
P                  ]
P                  ]
P                  ]
P                  ]
P                  .4      tE ! R" R]F4      tG ! R# R$]4      tHR% tIR& tJR' tK ! R( R)]4      tL ! R* R+]4      tMR, tNR- tOR. tP ! R/ R4      tQ ! R0 R]Q4      tR ! R1 R24      tS ! R3 R]S]Q4      tT ! R4 R]S]R4      tUR# )6    N)Iterable)copy)partial)
HTTPStatus)import_module)BytesIOIOBase)unquote_to_bytesurljoinurlsplit)sync_to_async)settings)ASGIRequest)BaseHandler)LimitedStreamWSGIRequest)DjangoJSONEncoder)got_request_exceptionrequest_finishedrequest_started)close_old_connections)HttpHeadersHttpRequest	QueryDictSimpleCookie)signals)ContextListresolve)force_bytes)SimpleLazyObject)	urlencode)_lazy_re_compileAsyncClientAsyncRequestFactoryClientRedirectCycleErrorRequestFactoryBoUnDaRyStRiNgz multipart/form-data; boundary=%sz.*; charset=([\w-]+);?z^application\/(.+\+)?jsonc                   6   a a ] tR t^;t oRtV 3R ltRtVtV ;t# )r'   z9The test client has been asked to follow a redirect loop.c                T   < \         SV `  V4       W n        VP                  V n        R # N)super__init__last_responseredirect_chain)selfmessager/   	__class__s   &&&G/var/www/idalgo/venv/lib/python3.14/site-packages/django/test/client.pyr.   RedirectCycleError.__init__>   s$    !*+::    )r/   r0   )	__name__
__module____qualname____firstlineno____doc__r.   __static_attributes____classdictcell____classcell__r3   __classdict__s   @@r4   r'   r'   ;   s     C; ;r6   c                   N   a  ] tR t^Dt o RtR	R ltR tR
R ltR
R ltR t	Rt
V tR# )FakePayloadz
A wrapper around BytesIO that restricts what can be read since data from
the network can't be sought and cannot be read outside of its content
length. This makes sure that views can't do anything under the test client
that wouldn't work in real life.
Nc                n    \        4       V n        ^ V n        RV n        Ve   V P	                  V4       R# R# )r   FN)r   _FakePayload__content_FakePayload__lenread_startedwrite)r1   initial_bytess   &&r4   r.   FakePayload.__init__L   s1     
!$JJ}% %r6   c                    V P                   # r,   )rE   )r1   s   &r4   __len__FakePayload.__len__S   s    zzr6   c               F   V P                   '       g#   V P                  P                  ^ 4       RV n         VR8X  g   Vf   V P                  pV P                  V8  g   Q R4       hV P                  P	                  V4      pV ;P                  \        V4      ,          un        V# r   TzFCannot read more than the available bytes from the HTTP incoming data.)rF   rD   seekrE   readlenr1   sizecontents   "" r4   rQ   FakePayload.readV   s       NN" $D2:::DJJ$	TS	T..%%d+

c'l"
r6   c               F   V P                   '       g#   V P                  P                  ^ 4       RV n         VR8X  g   Vf   V P                  pV P                  V8  g   Q R4       hV P                  P	                  V4      pV ;P                  \        V4      ,          un        V# rN   )rF   rD   rP   rE   readlinerR   rS   s   "" r4   rX   FakePayload.readlinec   s       NN" $D2:::DJJ$	TS	T..))$/

c'l"
r6   c                   V P                   '       d   \        R 4      h\        V4      pV P                  P	                  V4       V ;P
                  \        V4      ,          un        R# )z.Unable to write a payload after it's been readN)rF   
ValueErrorr    rD   rG   rE   rR   )r1   brU   s   "" r4   rG   FakePayload.writep   sG    MNNa.W%

c'l"
r6   )	__content__lenrF   r,   )rO   )r7   r8   r9   r:   r;   r.   rK   rQ   rX   rG   r<   r=   r@   s   @r4   rB   rB   D   s(     &# #r6   rB   c              #     "    T  R j  xL
  \         P                  ! \        4       V! 4        \         P                  ! \        4       R #  LA  \         P                  ! \        4       T! 4        \         P                  ! \        4       i ; i5ir,   r   
disconnectr   connect)iterablecloses   &&r4   closing_iterator_wrapperrg   x   s_     8##$9:  !67	 	##$9:  !67s+   BA AA =BA =B

Bc                4  "    V   R j  xL
  pV5x  K   LD \         P                  ! \        4       T! 4        \         P                  ! \        4       R #   \         P                  ! \        4       T! 4        \         P                  ! \        4       i ; i5ir,   rb   )re   rf   chunks   && r4   aclosing_iterator_wrapperrj      sp     8# 	 	%K	8 	##$9:  !67 	##$9:  !67s5   BA 	A A =B=BBc                   ^dVP                   u;8:  d   ^8  g   M VP                   R9   d"   VP                  '       d	   . Vn        MRVn        V P                  R8X  d#   VP                  '       d
   . Vn        V# RVn        V# )z
Simulate the behavior of most web servers by removing the content of
responses for HEAD requests, 1xx, 204, and 304 responses. Ensure
compliance with RFC 9112 Section 6.3.
r6   HEAD)   i0  )status_code	streamingstreaming_contentrU   method)requestresponses   &&r4   conditional_content_removalrt      sv     h""(S(H,@,@J,N)+H&"H~~)+H& O  #HOr6   c                   @   a a ] tR t^t oRtRV 3R lltR tRtVtV ;t	# )ClientHandlerz
An HTTP Handler that can be used for testing purposes. Use the WSGI
interface to compose requests, but return the raw HttpResponse object with
the originating WSGIRequest attached to its ``wsgi_request`` attribute.
c                4   < Wn         \        SV `  ! V/ VB  R # r,   enforce_csrf_checksr-   r.   r1   ry   argskwargsr3   s   &&*,r4   r.   ClientHandler.__init__       #6 $)&)r6   c                   V P                   f   V P                  4        \        P                  ! \        4       \        P
                  ! V P                  VR7       \        P                  ! \        4       \        V4      pV P                  '       * Vn
        V P                  V4      p\        W#4       W#n        VP                  '       db   VP                  '       d(   \!        VP"                  VP$                  4      Vn        V# \'        VP"                  VP$                  4      Vn         V# \(        P                  ! \        4       VP%                  4        \(        P                  ! \        4       V# )N)senderenviron)_middleware_chainload_middlewarer   rc   r   sendr3   rd   r   ry   _dont_enforce_csrf_checksget_responsert   wsgi_requestro   is_asyncrj   rp   rf   rg   r   )r1   r   rr   rs   s   &&  r4   __call__ClientHandler.__call__   s!    !!)  """#89DNNGD 56g&
 150H0H,H) $$W- 	$G6 !(    -F...*  .F...* 	 ''(=>NN$$%:;r6   ry   T
r7   r8   r9   r:   r;   r.   r   r<   r=   r>   r?   s   @@r4   rv   rv      s     *) )r6   rv   c                   @   a a ] tR t^t oRtRV 3R lltR tRtVtV ;t	# )AsyncClientHandlerz"An async version of ClientHandler.c                4   < Wn         \        SV `  ! V/ VB  R # r,   rx   rz   s   &&*,r4   r.   AsyncClientHandler.__init__   r~   r6   c           	       "   V P                   f   V P                  RR7       RV9   d   VP                  R4      pM\        R4      p\        P
                  ! \        4       \        P                  ! V P                  VR7      G R j  xL
  \        P                  ! \        4       \        V\        V\        V4      4      4      pV P                  '       * Vn        V P                  V4      G R j  xL
 p\!        W44       W4n        VP$                  '       db   VP&                  '       d(   \)        VP*                  VP,                  4      Vn        V# \/        VP*                  VP,                  4      Vn         V# \0        P
                  ! \        4       \3        VP,                  RR7      ! 4       G R j  xL
  \0        P                  ! \        4       V#  ELK L L%5i)NT)r   
_body_file )r   scopeF)thread_sensitive)r   r   poprB   r   rc   r   asendr3   rd   r   r   rR   ry   r   get_response_asyncrt   asgi_requestro   r   rj   rp   rf   rg   r   r   )r1   r   	body_filerr   rs   s   &&   r4   r   AsyncClientHandler.__call__   sv     !!)  $ /5 		,/I#BI""#89##4>>GGG 56e]9c)n%MN 150H0H,H)0099#G6 !(   -F...*  .F...* 	 ''(=>GIII$$%:;= 	H :& Js>   BGGA'G.G/8G(BG0G1!GGGr   r   r   r?   s   @@r4   r   r      s     ,** *r6   r   c                    V P                  R. 4      P                  V4       RV 9  d   \        4       V R&   V R,          P                  \        V4      4       R# )z
Store templates and contexts that are rendered.

The context is copied so that it is an accurate representation at the time
of rendering.
	templatescontextN)
setdefaultappendr   r   )storesignalr   templater   r|   s   &&&&&,r4   store_rendered_templatesr   	  sJ     
["%,,X6&=i	)DM*r6   c           	       a . pR oR pVP                  4        EF  w  rEVf   \        RV,          4      hV! V4      '       d   VP                  \        WV4      4       KG  \	        V\
        4      '       gz   \	        V\        4      '       dd   V F[  pV! V4      '       d   VP                  \        WV4      4       K.  VP                  V3R lRV ,          RV,          RV3 4       4       K]  	  K  VP                  V3R lRV ,          RV,          RV3 4       4       EK  	  VP                  S! R	V ,          4      R
.4       RP                  V4      # )a  
Encode multipart POST data from a dictionary of form values.

The key will be used as the form data name; the value will be transmitted
as content. If the value is a file, the contents of the file will be sent
as an application/octet-stream; otherwise, str(value) will be sent.
c                 6    \        V \        P                  4      # r,   r    r   DEFAULT_CHARSETss   &r4   to_bytes"encode_multipart.<locals>.to_bytes       1h6677r6   c                 T    \        V R 4      ;'       d    \        V P                  4      # )rQ   )hasattrcallablerQ   )things   &r4   is_file!encode_multipart.<locals>.is_file$  s     uf%>>(5::*>>r6   zeCannot encode None for key '%s' as POST data. Did you mean to pass an empty string or omit the value?c              3   4   <"   T F  pS! V4      x  K  	  R # 5ir,    .0valr   s   & r4   	<genexpr>#encode_multipart.<locals>.<genexpr>7  s"      !$C !$   --%sz)Content-Disposition: form-data; name="%s"r   c              3   4   <"   T F  pS! V4      x  K  	  R # 5ir,   r   r   s   & r4   r   r   A  s"      C r   z--%s--r6   s   
)items	TypeErrorextendencode_file
isinstancestrr   join)boundarydatalinesr   keyvalueitemr   s   &&     @r4   encode_multipartr     sB    E8? jjl
==?BC  U^^LLXE:;E3''Juh,G,G4==LLXD!ABLL ! #X-G#M 	$! 	  LL  X%?#E	 / #B 
LLX()	
 <<r6   c                    R  p\        VR4      ;'       d    \        VP                  \        4      pV'       d*   \        P
                  P                  VP                  4      MRp\        VR4      '       d   VP                  pM(V'       d   \        P                  ! V4      ^ ,          pMRpVf   RpT;'       g    TpV! RV ,          4      V! RV: RV: R	24      V! R
V,          4      RV! VP                  4       4      .# )c                 6    \        V \        P                  4      # r,   r   r   s   &r4   r   encode_file.<locals>.to_bytesU  r   r6   namer   content_typeNapplication/octet-streamr   z&Content-Disposition: form-data; name="z"; filename=""zContent-Type: %sr6   )r   r   r   r   ospathbasenamer   	mimetypes
guess_typerQ   )r   r   filer   file_has_string_namefilenamer   s   &&&    r4   r   r   T  s    8
 #40OOZ		35O.Brww		*Ht^$$((	 ++H5a813H("#JMxX	
 	#l23 r6   c                   $  a  ] tR tRt o RtR]RRRR/R ltR tR	 tR
 t	R t
R tRRRRR/R lltR]R3RRRR/R lltRRRRR/R lltRRRRR/R lltRRRRR/R lltRRRRR/R lltRRRRR/R lltRRRRR/R lltRRRRR/R lltRtV tR# )r(   ir  a6  
Class that lets you create mock Request objects for use in testing.

Usage:

rf = RequestFactory()
get_request = rf.get('/hello/')
post_request = rf.post('/submit/', {'foo': 'bar'})

Once you have a request object you can pass it to any view function,
just as if that view had been hooked up using a URLconf.
json_encoderheadersNquery_paramsc                  Wn         W@n        \        4       V n        \	        4       V n        V'       d0   V P                  P                  \        P                  ! V4      4       V'       d   \        VR R7      V P                  R&   R# R# )TdoseqQUERY_STRINGN)
r   defaultsr   cookiesr   errorsupdater   to_wsgi_namesr"   )r1   r   r   r   r   s   &$$$,r4   r.   RequestFactory.__init__  s^     ) #~iMM  !:!:7!CD,5l$,ODMM.) r6   c                    RRP                  \        R V P                  P                  4        4       4      4      RRRRRR	R
RRRRRRRRRRRR\	        R4      RV P
                  RRRRRR/V P                  CVC# )z%
The base environment for a request.
HTTP_COOKIEz; c              3   \   "   T F"  pVP                   : R VP                  : 2x  K$  	  R# 5i)=N)r   coded_valuer   morsels   & r4   r   /RequestFactory._base_environ.<locals>.<genexpr>  s&      "7  &zz6+=+=>"7s   *,	PATH_INFO/REMOTE_ADDR	127.0.0.1REQUEST_METHODGETSCRIPT_NAMEr   SERVER_NAME
testserverSERVER_PORT80SERVER_PROTOCOLzHTTP/1.1zwsgi.versionwsgi.url_schemehttp
wsgi.inputr6   zwsgi.errorszwsgi.multiprocessTzwsgi.multithreadFzwsgi.run_once)   r   )r   sortedr   valuesrB   r   r   r1   rr   s   &,r4   _base_environRequestFactory._base_environ  s     499 "&,,"5"5"7  ;e2<4zFv+c*4;;U)
* mm+
, -
 	
r6   c                8    \        V P                  ! R/ VB 4      # )#Construct a generic request object.r   )r   r  r  s   &,r4   rr   RequestFactory.request  s    4--8899r6   c                    V\         J d   \        \        V4      # \        P	                  V4      pV'       d   V^,          pM\
        P                  p\        WR7      # )r  )encoding)MULTIPART_CONTENTr   BOUNDARYCONTENT_TYPE_REmatchr   r   r    )r1   r   r   r  charsets   &&&  r4   _encode_dataRequestFactory._encode_data  sL    ,,#Hd33 $)),7E("22t66r6   c                    \         P                  V4      ;'       d    \        V\        \        \
        34      pV'       d"   \        P                  ! WP                  R7      # T# )z]
Return encoded JSON if data is a dict, list, or tuple and content_type
is application/json.
)cls)	JSON_CONTENT_TYPE_REr  r   dictlisttuplejsondumpsr   )r1   r   r   should_encodes   &&& r4   _encode_jsonRequestFactory._encode_json  sQ    
 -22<@ 
 
Z4u%F
 ;Htzz$$5$56QTQr6   c                N    \        VP                  4      pVP                  R 4      # )
iso-8859-1)r
   r   decode)r1   parsedr   s   && r4   	_get_pathRequestFactory._get_path  s!    , {{<((r6   Fc          	         V'       d   V'       d   \        R4      hT;'       g    TpVf   / MTpV P                  ! RV3RVRVRV/VB # )zConstruct a GET request.7query_params and data arguments are mutually exclusive.r   securer   r   r[   genericr1   r   r   r&  r   r   extras   &&&&$$,r4   getRequestFactory.get  sm     DVWW++|)1r|||
 
 	

 &
 
 	
r6   c          	         T P                  Vf   / MTV4      pV P                  W#4      pV P                  ! RVVV3RVRVRV/VB # )zConstruct a POST request.POSTr&  r   r   )r  r  r(  )	r1   r   r   r   r&  r   r   r*  	post_datas	   &&&&&$$, r4   postRequestFactory.post  sq       t||L%%d9	||		

 	
 	
 &	
 	
 		
r6   c          	         V'       d   V'       d   \        R4      hT;'       g    TpVf   / MTpV P                  ! RV3RVRVRV/VB # )zConstruct a HEAD request.r%  rl   r&  r   r   r'  r)  s   &&&&$$,r4   headRequestFactory.head  sm     DVWW++|)1r|||
 
 	

 &
 
 	
r6   c          	     6    V P                   ! RV3RVRVRV/VB # )zConstruct a TRACE request.TRACEr&  r   r   r(  )r1   r   r&  r   r   r*  s   &&&$$,r4   traceRequestFactory.trace  sA    ||
 
 	

 &
 
 	
r6   c          	     :    V P                   ! RVVV3RVRVRV/VB # )zConstruct an OPTIONS request.OPTIONSr&  r   r   r7  r1   r   r   r   r&  r   r   r*  s   &&&&&$$,r4   optionsRequestFactory.options  sI     ||		

 	
 	
 &	
 	
 		
r6   c          	     \    V P                  W#4      pV P                  ! RVVV3RVRVRV/VB # )zConstruct a PUT request.PUTr&  r   r   r  r(  r<  s   &&&&&$$,r4   putRequestFactory.put1  sY       4||		

 	
 	
 &	
 	
 		
r6   c          	     \    V P                  W#4      pV P                  ! RVVV3RVRVRV/VB # )zConstruct a PATCH request.PATCHr&  r   r   rA  r<  s   &&&&&$$,r4   patchRequestFactory.patchI  sY       4||		

 	
 	
 &	
 	
 		
r6   c          	     \    V P                  W#4      pV P                  ! RVVV3RVRVRV/VB # )zConstruct a DELETE request.DELETEr&  r   r   rA  r<  s   &&&&&$$,r4   deleteRequestFactory.deletea  sY       4||		

 	
 	
 &	
 	
 		
r6   c          
        \        \        V4      4      p	\        V\        P                  4      pRV P                  V	4      RTRV'       d   RMRRV'       d   RMR/p
V'       d3   V
P                  R	\        \        V4      4      R
VR\        V4      /4       V'       d&   VP                  \        P                  ! V4      4       V'       d   \        VRR7      VR&   V
P                  V4       V
P                  R4      '       g-   V	P                  P                  4       P                  R4      V
R&   V P                   ! R/ V
B # )$Construct an arbitrary HTTP request.r   r   r   443r   r   httpsr   CONTENT_LENGTHCONTENT_TYPEr   Tr   r   r  r   )r   r   r    r   r   r"  r   rR   rB   r   r   r"   r+  queryencoder   rr   )r1   rq   r   r   r   r&  r   r   r*  r!  rs   &&&&&&$$,  r4   r(  RequestFactory.genericy  s     #d)$4!9!9:/fF5&wf	
 HH$c#d)n"L +d"3 LL227;<$-l$$GE.!	uu^$$ & 3 3 5 < <\ JAn|| a  r6   )r   r   r   r   )NF)Fr   r   F)r7   r8   r9   r:   r;   r   r.   r  rr   r  r  r"  r+  r  r0  r3  r8  r=  rB  rF  rJ  r(  r<   r=   r`   s   @r4   r(   r(   r  s/    P 'P 	P
 P"
B:
7R)
8<
KO
( &
 
 
4
8<
KO
"	
4 	
d 	

 
 
.
 
 
0
 
 
0
 
 
0&! &! &! &!r6   c                   F   a  ] tR tRt o RtR tR tR
RRRR/R lltR	tV t	R# )r%   i  a  
Class that lets you create mock ASGI-like Request objects for use in
testing. Usage:

rf = AsyncRequestFactory()
get_request = rf.get("/hello/")
post_request = rf.post("/submit/", {"foo": "bar"})

Once you have a request object you can pass it to any view function,
including synchronous ones. The reason we have a separate class here is:
a) this makes ASGIRequest subclasses, and
b) AsyncClient can subclass it.
c                    RRR/RRRRRR	^ .R
RRRRRR. /V P                   CVCpVR,          P                  RRP                  \        R V P                  P                  4        4       4      4      34       V# )zThe base scope for a request.asgiversionz3.0typer   http_versionz1.1clientr   serverschemerq   r   r   s   cookies   ; c              3   z   "   T F1  pVP                   : R VP                  : 2P                  R4      x  K3  	  R# 5i)r   asciiN)r   r   rS  r   s   & r4   r   2AsyncRequestFactory._base_scope.<locals>.<genexpr>  s4      &;F %+JJ0B0BCKKGTT&;s   9;)r   r   )r   r   r   r  r   r  )r1   rr   r   s   &, r4   _base_scopeAsyncRequestFactory._base_scope  s     Y&FE{A&*fer
 mm
 
 	i

 &*ll&9&9&; 
	
 r6   c           	         RV9   d   VP                  R4      pM\        R4      p\        V P                  ! R/ VB \	        V\        V4      4      4      # )r  r   r   r   )r   rB   r   rc  r   rR   )r1   rr   r   s   &, r4   rr   AsyncRequestFactory.request  sN    
 7"L1I#BI'w'y#i.)Q
 	
r6   r   Nr   c                  \        \        V4      4      p	\        V\        P                  4      pRTRV P                  V	4      RRV'       d   RMR3RV'       d   RMR	R
R./p
V P                  '       d   / V P                  CVCpV'       d]   V
R
,          P                  R\        \        V4      4      P                  R4      3RVP                  R4      3.4       \        V4      V
R&   V'       d   \        VRR7      V
R&   M.VP                  RR4      ;p'       d   WR&   MV	P                  V
R&   V'       d&   VP                  \        P                   ! V4      4       T
R
;;,          VP#                  4        UUu. uF5  w  rVP%                  4       P                  R4      VP                  R4      3NK7  	  upp,          uu&   V P&                  ! R/ V
B # u uppi )rM  rq   r   r^  r   rN  r   r_  rO  r   r   s   content-lengthra  s   content-typer   Tr   query_stringr   Nlatin1)s   hosts
   testserverr   )r   r   r    r   r   r"  r   r   rR   rS  rB   r"   r   rR  r   r   to_asgi_namesr   lowerrr   )r1   rq   r   r   r   r&  r   r   r*  r!  r   rh  r   r   s   &&&&&&$$,     r4   r(  AsyncRequestFactory.generic  s    #d)$4!9!9:fDNN6*{VE>gV01
 ===.t}}..EiL&CI(=(=g(FG$l&9&9'&BC *$/AlO ),d CAn"YY~t<<\< ,n !'AnLL227;<	)#kkm
+
 YY[(%,,x*@A+
 	
 || a  	
s   8;Gr   rV  )
r7   r8   r9   r:   r;   rc  rr   r(  r<   r=   r`   s   @r4   r%   r%     s2     <
.! .! .! .!r6   c                      a  ] tR tRt o RtR tR t]R 4       tR t	R t
R tRR
 ltRR ltR tRR ltRR ltR tR tR tR tRRRRRR	RR	/R ltR tRtV tR	# )ClientMixini  z;
Mixin with common methods between Client and AsyncClient.
c                :    \         P                  ! 4       V n        R# )z3Store exceptions when they are generated by a view.N)sysexc_info)r1   r|   s   &,r4   store_exc_infoClientMixin.store_exc_info  s    r6   c                    V P                   Vn         V P                   '       d-   V P                   w  r#pRV n         V P                  '       d   VhR# R# )z
Look for a signaled exception, clear the current context exception
data, re-raise the signaled exception, and clear the signaled exception
from the local cache.
N)rq  raise_request_exception)r1   rs   _	exc_values   &&  r4   check_exceptionClientMixin.check_exception  sH     !MM==="mmOA! DM+++ , r6   c                ^   \        \        P                  4      pV P                  P	                  \        P
                  4      pV'       d   VP                  VP                  4      # VP                  4       pVP                  4        VP                  V P                  \        P
                  &   V# )z%Return the current session variables.)
r   r   SESSION_ENGINEr   r+  SESSION_COOKIE_NAMESessionStorer   savesession_keyr1   enginecookiesessions   &   r4   r  ClientMixin.session$  s|     x667!!(">">?&&v||44%%'5<5H5HX112r6   c                z  "   \        \        P                  4      pV P                  P	                  \        P
                  4      pV'       d   VP                  VP                  4      # VP                  4       pVP                  4       G R j  xL
  VP                  V P                  \        P
                  &   V#  L-5ir,   )
r   r   r{  r   r+  r|  r}  r   asaver  r  s   &   r4   asessionClientMixin.asession0  s     x667!!(">">?&&v||44%%'mmo5<5H5HX112 	s   B	B;B9.B;c                X    ^ RI Hp V! R/ VB pV'       d   V P                  V4       R# R# )z
Set the Factory to appear as if it has successfully logged into a site.

Return True if login is possible or False if the provided credentials
are incorrect.
)authenticateTFr   )django.contrib.authr  _login)r1   credentialsr  users   &,  r4   loginClientMixin.login:  s)     	5*k*KKr6   c                   "   ^ RI Hp V! R/ VB G Rj  xL
 pV'       d   V P                  V4      G Rj  xL
  R# R#  L) L
5i)zSee login().)aauthenticateNTFr   )r  r  _alogin)r1   r  r  r  s   &,  r4   aloginClientMixin.aloginI  s;     5"1[11,,t$$$	 2$s#   A>AAA 	A ANc                \    Vf   V P                  4       pW!n        V P                  W4       R # r,   )_get_backendbackendr  r1   r  r  s   &&&r4   force_loginClientMixin.force_loginS  s&    ?'')GD"r6   c                x   "   Vf   V P                  4       pW!n        V P                  W4      G R j  xL
  R #  L5ir,   )r  r  r  r  s   &&&r4   aforce_loginClientMixin.aforce_loginY  s/     ?'')Gll4)))s   /:8:c                |    ^ RI Hp \        P                   F!  pV! V4      p\	        VR4      '       g   K  Vu # 	  R# )r   )load_backendget_userN)r  r  r   AUTHENTICATION_BACKENDSr   )r1   r  backend_pathr  s   &   r4   r  ClientMixin._get_backend_  s2    4$<<L"<0Gw
++## =r6   c                2   ^ RI Hp \        4       pV P                  '       d   V P                  Vn        M.\	        \
        P                  4      pVP                  4       Vn        V! WAV4       VP                  P                  4        V P                  V4       R# )r   )r  N)
r  r  r   r  r   r   r{  r}  r~  _set_login_cookies)r1   r  r  r  rr   r  s   &&&   r4   r  ClientMixin._loging  sj    - -<<<"llGO"8#:#:;F$113GOgW%(r6   c                l  "   ^ RI Hp \        4       pV P                  4       G Rj  xL
 pV'       d   WTn        M.\        \        P                  4      pVP                  4       Vn        V! WAV4      G Rj  xL
  VP                  P                  4       G Rj  xL
  V P                  V4       R#  L L; L5i)r   )r  N)r  r  r   r  r  r   r   r{  r}  r  r  )r1   r  r  r  rr   r  r  s   &&&    r4   r  ClientMixin._aloginv  s     . -'%O"8#:#:;F$113GOWG,,,oo##%%%( ( 	-%s9   $B4B.B4AB44B05!B4B2B40B42B4c           
        \         P                  pVP                  P                  V P                  V&   R RRRR\         P
                  R\         P                  ;'       g    RRR/pV P                  V,          P                  V4       R# )zmax-ageNr   r   domainr&  expires)r   r|  r  r  r   SESSION_COOKIE_DOMAINSESSION_COOKIE_SECUREr   )r1   rr   session_cookiecookie_datas   &&  r4   r  ClientMixin._set_login_cookies  sr    !55'.'B'B^$tCh44h44<<t
 	^$++K8r6   c                   ^ RI HpHp \        4       pV P                  '       d    V P                  Vn        V! V4      Vn        M.\        \        P                  4      pVP                  4       Vn        V! V4       \        4       V n        R# )z<Log out the user by removing the cookies and session object.)r  logoutN)r  r  r  r   r  r  r   r   r{  r}  r   r   )r1   r  r  rr   r  s   &    r4   r  ClientMixin.logout  s\    8-<<<"llGO#G,GL"8#:#:;F$113GOw#~r6   c                P  "   ^ RI HpHp \        4       pV P	                  4       G Rj  xL
 pV'       d   WCn        V! V4      G Rj  xL
 Vn        M.\        \        P                  4      pVP                  4       Vn        V! V4      G Rj  xL
  \        4       V n        R#  Lw L[ L5i)zSee logout().)	aget_useralogoutN)r  r  r  r   r  r  r  r   r   r{  r}  r   r   )r1   r  r  rr   r  r  s   &     r4   r  ClientMixin.alogout  sz     :-'%O!*7!33GL"8#:#:;F$113GOg#~ ( 4 	s9   &B&B B&B&B"AB&
B$B&"B&$B&c                    \        VR 4      '       gr   \        P                  VP                  R4      4      '       g"   \	        RVP                  R4      ,          4      h\
        P                  ! VP                  3/ VB Vn        VP                  # )_jsonzContent-Typez3Content-Type header is "%s", not "application/json")	r   r  r  r+  r[   r  loadstextr  )r1   rs   r*  s   &&,r4   _parse_jsonClientMixin._parse_json  so    x))'--hll>.JKK Ill>23  "ZZ??HN~~r6   r   r   r   r   r   c               ~   VP                   pVP                  pVP                  WqP                  34       \	        V4      p	V	P
                  '       d   V	P
                  VR&   V	P                  '       d   V	P                  VR&   V	P                  VR&   V	P                  '       d   \        V	P                  4      VR&   V	P                  p
V
'       g   V	P                  '       d   Rp
V
P                  R4      '       g   \        VP                  R,          V
4      p
VP                  \        P                  \        P                   39   dD   VP                  R,          P#                  4       pVR9  d   V	P$                  VR&   \'        W4      pM#V P(                  p\+        V	P$                  4      pR	pV! V
3R
VRVRRRVRV/VB # )z9Follow a single redirect contained in response using GET.r   r   	HTTP_HOSTr   r   r   r   r   Nr   r   followFr   r   )r+  r3  )urlr0   r   rn   r   r_  hostnameportr   r   netloc
startswithr   rr   r   TEMPORARY_REDIRECTPERMANENT_REDIRECTrk  rR  getattrr+  r   )r1   rs   r   r   r   r   r*  response_urlr0   r  r   request_methods   &&$$$$,     r4   _follow_redirectClientMixin._follow_redirect  s     ||!00|-A-ABC|$:::'*zzE#$<<<#&<<E- !$E+888#&sxx=E- xx


Ds##8++K8$?D))))$
 
 &--.>?EEGN_4(+		n%$T:N!XXNSYY'DL

 &
 	

 
 &
 
 	
r6   c                    VP                   pVR,          VRR 9   d   \        RVR7      h\        V4      ^8  d   \        RVR7      hR# )zE
Raise a RedirectCycleError if response contains too many redirects.
NzRedirect loop detected.)r/   zToo many redirects.rO   )r0   r'   rR   )r1   rs   r0   s   && r4   _ensure_redirects_not_cyclic(ClientMixin._ensure_redirects_not_cyclic  sU     "00"!44 %%>hWW~# %%:(SS	 $r6   )r   rq  r,   )r7   r8   r9   r:   r;   rr  rx  propertyr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r<   r=   r`   s   @r4   rn  rn    s     '  	 	#*$))"9&&7
 	7

 7
 7
 7
rT Tr6   rn  c                   >  a a ] tR tRt oRtRRRRR/V 3R llltR tRRRRR/V 3R	 llltR]RR3RRRR/V 3R
 lllt	RRRRR/V 3R lllt
RRRRR/V 3R llltRRRRR/V 3R llltRRRRR/V 3R llltRRRRR/V 3R llltRRRRR/V 3R llltRR ltRtVtV ;t# )r&   i  a  
A class that can act as a client for testing purposes.

It allows the user to compose GET and POST requests, and
obtain the response that the server gave to those requests.
The server Response objects are annotated with the details
of the contexts and templates that were rendered during the
process of serving the request.

Client objects are stateful - they will retain cookie (and
thus session) details for the lifetime of the Client instance.

This is not intended as a replacement for Twill/Selenium or
the like - it is here to allow testing against the
contexts and templates produced by a view, rather than the
HTML rendered to the end-user.
Fr   Nr   c                  < \         SV `  ! RR VRV/VB  \        V4      V n        W n        RV n        RV n        RV n        R# r   r   Nr   )r-   r.   rv   handlerru  rq  r*  r   r1   ry   ru  r   r   r   r3   s   &&&$$,r4   r.   Client.__init__  sG     	PP|PxP$%89'>$
r6   c                B  aa V P                   ! R	/ SB p/ p\        \        V4      pR\        S4      ,          p\        P
                  P                  WER7       R\        S4      ,          p\        P                  ! V P                  VR7        V P                  V4      p\        P
                  P                  VR7       \        P                  ! VR7       V P                  V4       Wn        SVn        VP                  R. 4      Vn        VP                  R4      Vn        \        V P"                  V4      Vn        \'        VP(                  RR4      o\+        VV3R l4      Vn        VP                   '       d3   \/        VP                   4      ^8X  d   VP                   ^ ,          Vn        VP0                  '       d&   V P0                  P3                  VP0                  4       V#   \        P
                  P                  TR7       \        P                  ! TR7       i ; i)
z
Make a generic request. Compose the environment dictionary and pass
to the handler, return the result of the handler. Assume defaults for
the query environment, which can be overridden using the arguments to
the request.
template-render-%sdispatch_uidrequest-exception-%sr   r   urlconfNc                  ,   < \        S R ,          SR7      # )r   r  r   rr   r  s   r4   <lambda> Client.request.<locals>.<lambda>J  s    GGK0'Br6   r   )r  r   r   idr   template_renderedrd   r   rr  r  rc   rx  r]  rr   r+  r   r   r  r  r  r   r!   resolver_matchrR   r   r   )	r1   rr   r   r   on_template_render
signal_uidexception_uidrs   r  s	   &l      @r4   rr   Client.request'  s    $$/w/ $%=tD)BwK7
!!))*<)V.G<%%d&9&9V	I||G,H%%00j0I!,,-HX&"!XXk2688I. 0 0(;(//DA"2B#
 H$4$4 5 :'//2HLL 0 011 %%00j0I!,,-Hs   G% %9Hc                  < Wpn         WPn        \        S	V `  ! V3RVRVRVRV/VB pV'       d   V P                  ! V3RVRVRV/VB pV# )-Request a response from the server using GET.r   r&  r   r   )r*  r   r-   r+  _handle_redirects
r1   r   r   r  r&  r   r   r*  rs   r3   s
   &&&&&$$, r4   r+  
Client.getV  s     
7;

 
 	

 &
 
 --#-4COSXH r6   c                  < Wn         W`n        \        S
V `  ! V3RVRVRVRVRV/VB p	V'       d   V P                  ! V	3RVRVRVRV/VB p	V	# ).Request a response from the server using POST.r   r   r&  r   r   )r*  r   r-   r0  r  r1   r   r   r   r  r&  r   r   r*  rs   r3   s   &&&&&&$$, r4   r0  Client.postr  s     
7<

 &
 	

 
 &
 
 -- *  	
 * H r6   c                  < Wpn         WPn        \        S	V `  ! V3RVRVRVRV/VB pV'       d   V P                  ! V3RVRVRV/VB pV# ).Request a response from the server using HEAD.r   r&  r   r   )r*  r   r-   r3  r  r  s
   &&&&&$$, r4   r3  Client.head  s     
7<

 
 	

 &
 
 --#-4COSXH r6   c                  < Wn         W`n        \        S
V `  ! V3RVRVRVRVRV/VB p	V'       d   V P                  ! V	3RVRVRVRV/VB p	V	# )1Request a response from the server using OPTIONS.r   r   r&  r   r   )r*  r   r-   r=  r  r  s   &&&&&&$$, r4   r=  Client.options  s     
7?

 &
 	

 
 &
 
 -- *  	
 * H r6   c                  < Wn         W`n        \        S
V `  ! V3RVRVRVRVRV/VB p	V'       d   V P                  ! V	3RVRVRVRV/VB p	V	# )(Send a resource to the server using PUT.r   r   r&  r   r   )r*  r   r-   rB  r  r  s   &&&&&&$$, r4   rB  
Client.put  s     
7;

 &
 	

 
 &
 
 -- *  	
 * H r6   c                  < Wn         W`n        \        S
V `  ! V3RVRVRVRVRV/VB p	V'       d   V P                  ! V	3RVRVRVRV/VB p	V	# )*Send a resource to the server using PATCH.r   r   r&  r   r   )r*  r   r-   rF  r  r  s   &&&&&&$$, r4   rF  Client.patch  s     
7=

 &
 	

 
 &
 
 -- *  	
 * H r6   c                  < Wn         W`n        \        S
V `  ! V3RVRVRVRVRV/VB p	V'       d   V P                  ! V	3RVRVRVRV/VB p	V	# )$Send a DELETE request to the server.r   r   r&  r   r   )r*  r   r-   rJ  r  r  s   &&&&&&$$, r4   rJ  Client.delete  s     
7>

 &
 	

 
 &
 
 -- *  	
 * H r6   c                  < Wpn         WPn        \        S	V `  ! V3RVRVRVRV/VB pV'       d   V P                  ! V3RVRVRV/VB pV# )#Send a TRACE request to the server.r   r&  r   r   )r*  r   r-   r8  r  r  s
   &&&&&$$, r4   r8  Client.trace=  s     
7=

 
 	

 &
 
 --#-4COSXH r6   c                    . Vn         VP                  \        9   dA   VP                   pV P                  ! V3RVRVRVRV/VB pWqn         V P	                  V4       KU  V# )I
Follow any redirects by requesting responses from the server using GET.
r   r   r   r   r0   rn   REDIRECT_STATUS_CODESr  r  r1   rs   r   r   r   r   r*  r0   s   &&&&&&, r4   r  Client._handle_redirectsY  s     #%""&;;%44N,, *  	
 * H '5#--h7r6   rq  r*  r  r   ru  FTNFFr   r   FFr   FFr   r   NN)r7   r8   r9   r:   r;   r.   rr   r+  r  r0  r3  r=  rB  rF  rJ  r8  r  r<   r=   r>   r?   s   @@r4   r&   r&     s;    $
    -^   > &! ! ! !F   8! ! ! !F! ! ! !F! ! ! !F! ! ! !F   8 r6   c                   >  a a ] tR tRt oRtRRRRR/V 3R llltR tRRRRR/V 3R	 llltR]RR3RRRR/V 3R
 lllt	RRRRR/V 3R lllt
RRRRR/V 3R llltRRRRR/V 3R llltRRRRR/V 3R llltRRRRR/V 3R llltRRRRR/V 3R llltRR ltRtVtV ;t# )r$   iu  z
An async version of Client that creates ASGIRequests and calls through an
async request path.

Does not currently support "follow" on its methods.
Fr   Nr   c                  < \         SV `  ! RR VRV/VB  \        V4      V n        W n        RV n        RV n        RV n        R# r  )r-   r.   r   r  ru  rq  r*  r   r  s   &&&$$,r4   r.   AsyncClient.__init__}  sG     	PP|PxP)*=>'>$
r6   c                `  aa"   V P                   ! R	/ SB p/ p\        \        V4      pR\        S4      ,          p\        P
                  P                  WER7       R\        S4      ,          p\        P                  ! V P                  VR7        V P                  V4      G Rj  xL
 p\        P
                  P                  VR7       \        P                  ! VR7       V P                  V4       Wn        SVn        VP                  R. 4      Vn        VP                  R4      Vn        \        V P"                  V4      Vn        \'        VP(                  RR4      o\+        VV3R l4      Vn        VP                   '       d3   \/        VP                   4      ^8X  d   VP                   ^ ,          Vn        VP0                  '       d&   V P0                  P3                  VP0                  4       V#  ELK  \        P
                  P                  TR7       \        P                  ! TR7       i ; i5i)
z
Make a generic request. Compose the scope dictionary and pass to the
handler, return the result of the handler. Assume defaults for the
query environment, which can be overridden using the arguments to the
request.
r  r  r  Nr   r   r  c                  ,   < \        S R ,          SR7      # )r   r  r   r  s   r4   r  %AsyncClient.request.<locals>.<lambda>  s    GGFOW=r6   r   )rc  r   r   r  r   r  rd   r   rr  r  rc   rx  r]  rr   r+  r   r   r  r  r  r   r!   r  rR   r   r   )	r1   rr   r   r   r  r  r  rs   r  s	   &l      @r4   rr   AsyncClient.request  s       +7+ $%=tD)BwK7
!!))*<)V.G<%%d&9&9V	I!\\%00H%%00j0I!,,-HX&"!XXk2688I. 0 0(;(//DA"2=#
 H$4$4 5 :'//2HLL 0 015 1%%00j0I!,,-Hs7   BH.G2 $G/%G2 )DH.'H./G2 29H++H.c                  <"   Wpn         WPn        \        S	V `  ! V3RVRVRVRV/VB G Rj  xL
 pV'       d"   V P                  ! V3RVRVRV/VB G Rj  xL
 pV#  L/ L5i)r  r   r&  r   r   N)r*  r   r-   r+  _ahandle_redirectsr  s
   &&&&&$$, r4   r+  AsyncClient.get  s      


 
 	

 &
 
 
 !44#-4COSX H 
&   )A AA A AA A c                  <"   Wn         W`n        \        S
V `  ! V3RVRVRVRVRV/VB G Rj  xL
 p	V'       d$   V P                  ! V	3RVRVRVRV/VB G Rj  xL
 p	V	#  L1 L5i)r  r   r   r&  r   r   N)r*  r   r-   r0  r  r  s   &&&&&&$$, r4   r0  AsyncClient.post  s      


 &
 	

 
 &
 
 
 !44 *  	
 *  H %
&   +A$A A$A$A"A$"A$c                  <"   Wpn         WPn        \        S	V `  ! V3RVRVRVRV/VB G Rj  xL
 pV'       d"   V P                  ! V3RVRVRV/VB G Rj  xL
 pV#  L/ L5i)r  r   r&  r   r   N)r*  r   r-   r3  r  r  s
   &&&&&$$, r4   r3  AsyncClient.head  s      


 
 	

 &
 
 
 !44#-4COSX H 
r  c                  <"   Wn         W`n        \        S
V `  ! V3RVRVRVRVRV/VB G Rj  xL
 p	V'       d$   V P                  ! V	3RVRVRVRV/VB G Rj  xL
 p	V	#  L1 L5i)r  r   r   r&  r   r   N)r*  r   r-   r=  r  r  s   &&&&&&$$, r4   r=  AsyncClient.options  s      


 &
 	

 
 &
 
 
 !44 *  	
 *  H %
r  c                  <"   Wn         W`n        \        S
V `  ! V3RVRVRVRVRV/VB G Rj  xL
 p	V'       d$   V P                  ! V	3RVRVRVRV/VB G Rj  xL
 p	V	#  L1 L5i)r  r   r   r&  r   r   N)r*  r   r-   rB  r  r  s   &&&&&&$$, r4   rB  AsyncClient.put9  s      


 &
 	

 
 &
 
 
 !44 *  	
 *  H %
r  c                  <"   Wn         W`n        \        S
V `  ! V3RVRVRVRVRV/VB G Rj  xL
 p	V'       d$   V P                  ! V	3RVRVRVRV/VB G Rj  xL
 p	V	#  L1 L5i)r  r   r   r&  r   r   N)r*  r   r-   rF  r  r  s   &&&&&&$$, r4   rF  AsyncClient.patch\  s      


 &
 	

 
 &
 
 
 !44 *  	
 *  H %
r  c                  <"   Wn         W`n        \        S
V `  ! V3RVRVRVRVRV/VB G Rj  xL
 p	V'       d$   V P                  ! V	3RVRVRVRV/VB G Rj  xL
 p	V	#  L1 L5i)r   r   r   r&  r   r   N)r*  r   r-   rJ  r  r  s   &&&&&&$$, r4   rJ  AsyncClient.delete  s      


 &
 	

 
 &
 
 
 !44 *  	
 *  H %
r  c                  <"   Wpn         WPn        \        S	V `  ! V3RVRVRVRV/VB G Rj  xL
 pV'       d"   V P                  ! V3RVRVRV/VB G Rj  xL
 pV#  L/ L5i)r  r   r&  r   r   N)r*  r   r-   r8  r  r  s
   &&&&&$$, r4   r8  AsyncClient.trace  s      


 
 	

 &
 
 
 !44#-4COSX H 
r  c                   "   . Vn         VP                  \        9   dI   VP                   pV P                  ! V3RVRVRVRV/VB G Rj  xL
 pWqn         V P	                  V4       K]  V#  L5i)r  r   r   r   r   Nr  r	  s   &&&&&&, r4   r  AsyncClient._ahandle_redirects  s      #%""&;;%44N!22 *  	
 *  H '5#--h7s   AA+	A)
 A+r  r  r  r  r  r  )r7   r8   r9   r:   r;   r.   rr   r+  r  r0  r3  r=  rB  rF  rJ  r8  r  r<   r=   r>   r?   s   @@r4   r$   r$   u  s;    
    ,\   > &! ! ! !F   8! ! ! !F! ! ! !F! ! ! !F! ! ! !F   8 r6   )r$   r%   r&   r'   r(   r   r   )Vr  r   r   rp  collections.abcr   r   	functoolsr   r   r   	importlibr   ior   r	   urllib.parser
   r   r   asgiref.syncr   django.confr   django.core.handlers.asgir   django.core.handlers.baser   django.core.handlers.wsgir   r   django.core.serializers.jsonr   django.core.signalsr   r   r   	django.dbr   django.httpr   r   r   r   django.testr   django.test.utilsr   django.urlsr   django.utils.encodingr    django.utils.functionalr!   django.utils.httpr"   django.utils.regex_helperr#   __all__r  r  r  r  	frozensetMOVED_PERMANENTLYFOUND	SEE_OTHERr  r  r  	Exceptionr'   rB   rg   rj   rt   rv   r   r   r   r   r(   r%   rn  r&   r$   r   r6   r4   <module>rH     sk     	 
 $    #  < < &   1 1 @ : X X + I I  )  - 4 ' 6 6A "#<='(DE !$$%%%% ; ;1#& 1#h88&4K 4n1 1h
+;|<m! m!`	i!. i!XsT sTln[. nbb+2 br6   