%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/twisted/web/test/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/twisted/web/test/__pycache__/test_pages.cpython-312.pyc

�

Ϫ�f@���dZddlmZddlmZddlmZddlmZddl	m
Z
mZmZddl
mZddlmZd	ed
efd�ZGd�d
e�Zy)z
Test L{twisted.web.pages}
�)�cast)�SynchronousTestCase)�Headers)�IRequest)�	errorPage�	forbidden�notFound)�	IResource)�DummyRequest�resource�returnc�\�tdg�}|jtt|��|S)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�renderrr)r�requests  �=/usr/lib/python3/dist-packages/twisted/web/test/test_pages.py�_renderrs*���C�5�!�G�
�O�O�D��7�+�,��Nrc�L�eZdZdZdZdedededdfd�Zdd�Z	dd	�Z
dd
�Zdd�Zy)
�ErrorPageTestszu
    Test L{twisted.web.pages._ErrorPage} and its public aliases L{errorPage},
    L{notFound} and L{forbidden}.
    Nr�code�bodyr
c��|j|j|�|j|jtddgi��|jdj	|j
�j
d�|j
d��y)Nscontent-typestext/html; charset=utf-8rzlatin-1)�assertEqual�responseCode�responseHeadersr�join�written�decode)�selfrrrs    r�assertResponsezErrorPageTests.assertResponse*sy������-�-�t�4�����#�#��_�'B�&C�D�E�	
�	
���
�H�H�W�_�_�%�,�,�Y�7��K�K�	�"�		
rc	�R�|jttddd��dd�y)zS
        The I{brief} and I{detail} parameters are HTML-escaped on render.
        i�zA & 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 rr�rs r�test_escapesHTMLzErrorPageTests.test_escapesHTML7s,��	
����I�c�7�,D�E�F��&�			
rc��tddd�}|j|jdtttdg���|�y)z�
        The C{getChild} method of the resource returned by L{errorPage} returns
        the L{_ErrorPage} it is called on.
        ��foo�barsnamerN)r�assertIs�getChildrrr)r�pages  r�
test_getChildzErrorPageTests.test_getChildFs=��
��e�U�+���
�
��M�M�'�4��,��u�2E�#F�G��	
rc�L�|jtt��dd�y)zq
        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 rr	r"s r�test_notFoundDefaultsz$ErrorPageTests.test_notFoundDefaultsQs$��
	
����H�J���"�	
	
rc�L�|jtt��dd�y)zr
        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 rrr"s r�test_forbiddenDefaultsz%ErrorPageTests.test_forbiddenDefaultsbs$��
	
����I�K� ��"�	
	
r)r
N)
�__name__�
__module__�__qualname__�__doc__�maxDiffr�int�bytesr r#r+r-r/�rrrr"sC���
�G�
�l�
�#�
�U�
�t�
�

�	
�
�"
rrN)r3�typingr�twisted.trial.unittestr�twisted.web.http_headersr�twisted.web.iwebr�twisted.web.pagesrrr	�twisted.web.resourcer
�twisted.web.test.requesthelperrrrr7rr�<module>r?sF����6�,�%�<�<�*�7�
�i�
�L�
� O
�(�O
r

Zerion Mini Shell 1.0