ó
    ×›‘h@  ã                   óŒ   • S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
JrJr  SSKJr  SSKJr  S	\S
\4S jr " S S\5      rg)z
Test L{twisted.web.pages}
é    )Úcast)ÚSynchronousTestCase)ÚHeaders)ÚIRequest)Ú	errorPageÚ	forbiddenÚnotFound)Ú	IResource)ÚDummyRequestÚresourceÚreturnc                 ó\   • [        S/5      nU R                  [        [        U5      5        U$ )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   Úrenderr   r   )r   Úrequests     Ú_C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/web/test/test_pages.pyÚ_renderr      s*   € ô ˜C˜5Ó!€Gð ‡O�O”Dœ 7Ó+Ô,Ø€Nr   c                   ó^   • \ rS rSrSrSrS\S\S\SS4S jr	SS	 jr
SS
 jrSS jrSS jrSrg)ÚErrorPageTestsé"   zi
Test L{twisted.web.pages._ErrorPage} and its public aliases L{errorPage},
L{notFound} and L{forbidden}.
Nr   ÚcodeÚbodyr   c                 ó  • U R                  UR                  U5        U R                  UR                  [        SS/05      5        U R                  SR	                  UR
                  5      R                  S5      UR                  S5      5        g )Ns   content-types   text/html; charset=utf-8r   zlatin-1)ÚassertEqualÚresponseCodeÚresponseHeadersr   ÚjoinÚwrittenÚdecode)Úselfr   r   r   s       r   ÚassertResponseÚErrorPageTests.assertResponse*   sy   € Ø×Ñ˜×-Ñ-¨tÔ4Ø×ÑØ×#Ñ#Ü�_Ð'BÐ&CÐDÓEô	
ð 	×Ñð �H‰H�W—_‘_Ó%×,Ñ,¨YÓ7Ø�K‰K˜	Ó"õ		
r   c           	      óR   • U R                  [        [        SSS5      5      SS5        g)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,   € ð 	×ÑÜ”I˜c 7Ð,DÓEÓFØð&õ			
r   c                 ó’   • [        SSS5      nU R                  UR                  S[        [        [        S/5      5      5      U5        g)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=   € ô
 ˜˜e UÓ+ˆØ�‰Ø�M‰M˜'¤4¬´,À¸uÓ2EÓ#FÓGØõ	
r   c                 óL   • U R                  [        [        5       5      SS5        g)zY
The default arguments to L{twisted.web.pages.notFound} produce
a reasonable error page.
r(   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$   € ð
 	×ÑÜ”H“JÓØð"õ	
	
r   c                 óL   • U R                  [        [        5       5      SS5        g)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$   € ð
 	×ÑÜ”I“KÓ Øð"õ	
	
r   © )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚmaxDiffr   ÚintÚbytesr!   r%   r.   r1   r4   Ú__static_attributes__r6   r   r   r   r   "   sC   † ñð
 €Gð
 lð 
¸#ð 
ÀUð 
Ètô 
ô
ô	
ô
÷"
r   r   N)r;   Ú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   r6   r   r   Ú<module>rG      sF   ðñõ å 6Ý ,Ý %ß <Ñ <Ý *Ý 7ð�ið  Lô ô O
Ð(õ O
r   