File: //usr/lib/python3/dist-packages/twisted/web/test/__pycache__/test_resource.cpython-310.pyc
o
�b�# � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZm Z m
Z
mZmZm
Z
mZ ddlmZ G dd� de�ZG d d
� d
e
�ZG dd� de
�ZG d
d� de
�ZG dd� de
�ZG dd� de�ZG dd� de�ZdS )z$
Tests for L{twisted.web.resource}.
� )�TestCase)�UnsupportedMethod)�Headers)� FORBIDDEN� NOT_FOUND� ErrorPage�ForbiddenResource�
NoResource�Resource�getChildForRequest)�DummyRequestc @ sD e Zd ZdZeZeZeZ dd� Z
dd� Zdd� Zdd � Z
d
d� ZdS )
�ErrorPageTestszJ
Tests for L{ErrorPage}, L{NoResource}, and L{ForbiddenResource}.
c C s( | � ddd�}| �|�dt� �|� dS )zj
The C{getChild} method of L{ErrorPage} returns the L{ErrorPage} it is
called on.
�A �foo�bars nameN)� errorPage�assertIdentical�getChild�object)�self�page� r �@/usr/lib/python3/dist-packages/twisted/web/test/test_resource.py�
test_getChild s zErrorPageTests.test_getChildc C s` t dg�}d}|||||f }| �|�|�|�d�� | �|j|� | �|jtddgi�� d S )N� zg
<html>
<head><title>%s - %s</title></head>
<body>
<h1>%s</h1>
<p>%s</p>
</body>
</html>
zutf-8s content-types text/html; charset=utf-8)r �assertEqual�render�encode�responseCode�responseHeadersr )r r �code�brief�detail�request�template�expectedr r r �_pageRenderingTest( s
�
�z!ErrorPageTests._pageRenderingTestc C s. d}d}d}| � |||�}| �||||� dS )a
L{ErrorPage.render} returns a C{bytes} describing the error defined by
the response code and message passed to L{ErrorPage.__init__}. It also
uses that response code to set the response code on the L{Request}
passed in.
r zbrief description textzmuch longer text might go hereN)r r&