+
    Dfj@                         R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
HtHt ^ RIHt ^ RIHt R R	 lt ! R
 R]4      tR# )z
Test L{twisted.web.pages}
)cast)SynchronousTestCase)Headers)IRequest)	errorPage	forbiddennotFound)	IResource)DummyRequestc                0    V ^8  d   QhR\         R\        /# )   resourcereturn)r	   r
   )formats   "=/usr/lib/python3/dist-packages/twisted/web/test/test_pages.py__annotate__r      s      i L     c                \    \        R.4      pV P                  \        \        V4      4       V# )z
Render a response using the given resource.

@param resource: The resource to use to handle the request.

@returns: The request that the resource handled,
r   )r
   renderr   r   )r   requests   & r   _renderr      s*     C5!G OOD7+,Nr   c                      a  ] tR t^"t o RtRtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 lt	V 3R lR lt
RtV tR# )ErrorPageTestszi
Test L{twisted.web.pages._ErrorPage} and its public aliases L{errorPage},
L{notFound} and L{forbidden}.
Nc                0   < V ^8  d   QhRS[ RS[RS[RR/# )r   r   codebodyr   N)r
   intbytes)r   __classdict__s   "r   r   ErrorPageTests.__annotate__*   s)     
 
l 
# 
U 
t 
r   c                    V P                  VP                  V4       V P                  VP                  \        R R./4      4       V P                  RP	                  VP
                  4      P                  R4      VP                  R4      4       R# )s   content-types   text/html; charset=utf-8r   zlatin-1N)assertEqualresponseCoderesponseHeadersr   joinwrittendecode)selfr   r   r   s   &&&&r   assertResponseErrorPageTests.assertResponse*   sy    --t4##_'B&CDE	
 	 HHW__%,,Y7KK	"		
r   c                   < V ^8  d   QhRR/# r   r   N )r   r   s   "r   r   r   7   s     
 
$ 
r   c           	     T    V P                  \        \        RRR4      4      RR4       R# )zC
The I{brief} and I{detail} parameters are HTML-escaped on render.
i  zA & Bz<script>alert('oops!')s   <!DOCTYPE html>
<html><head><title>400 - A &amp; B</title></head><body><h1>A &amp; B</h1><p>&lt;script&gt;alert('oops!')</p></body></html>N)r(   r   r   r'   s   &r   test_escapesHTMLErrorPageTests.test_escapesHTML7   s,     	Ic7,DEF&			
r   c                   < V ^8  d   QhRR/# r+   r,   )r   r   s   "r   r   r   F   s     	
 	
t 	
r   c                    \        RRR4      pV P                  VP                  R\        \        \        R.4      4      4      V4       R# )zl
The C{getChild} method of the resource returned by L{errorPage} returns
the L{_ErrorPage} it is called on.
  foobars   namer   N)r   assertIsgetChildr   r   r
   )r'   pages   & r   test_getChildErrorPageTests.test_getChildF   s=    
 eU+MM'4,u2E#FG	
r   c                   < V ^8  d   QhRR/# r+   r,   )r   r   s   "r   r   r   Q   s     
 
t 
r   c                N    V P                  \        \        4       4      RR4       R# )zY
The default arguments to L{twisted.web.pages.notFound} produce
a reasonable error page.
r3   s   <!DOCTYPE html>
<html><head><title>404 - No Such Resource</title></head><body><h1>No Such Resource</h1><p>Sorry. No luck finding that resource.</p></body></html>N)r(   r   r   r.   s   &r   test_notFoundDefaults$ErrorPageTests.test_notFoundDefaultsQ   s$    
 	HJ"	
	
r   c                   < V ^8  d   QhRR/# r+   r,   )r   r   s   "r   r   r   b   s     
 
 
r   c                N    V P                  \        \        4       4      RR4       R# )zZ
The default arguments to L{twisted.web.pages.forbidden} produce
a reasonable error page.
i  s   <!DOCTYPE html>
<html><head><title>403 - Forbidden Resource</title></head><body><h1>Forbidden Resource</h1><p>Sorry, resource is forbidden.</p></body></html>N)r(   r   r   r.   s   &r   test_forbiddenDefaults%ErrorPageTests.test_forbiddenDefaultsb   s$    
 	IK "	
	
r   r,   )__name__
__module____qualname____firstlineno____doc__maxDiffr(   r/   r9   r=   rA   __static_attributes____classdictcell__)r   s   @r   r   r   "   sC     
 G
 

 
	
 	

 
"
 
r   r   N)rG   typingr   twisted.trial.unittestr   twisted.web.http_headersr   twisted.web.iwebr   twisted.web.pagesr   r   r   twisted.web.resourcer	   twisted.web.test.requesthelperr
   r   r   r,   r   r   <module>rR      s8     6 , % < < * 7 O
( O
r   