Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/twisted/web/test/__pycache__/ |
Upload File : |
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&