AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/twisted/web/test/__pycache__/test_script.cpython-310.pyc
o

�b��@s|dZddlZddlmZddlmZddlmZddlm	Z	m
Z
ddlmZddl
mZGd	d
�d
e�ZGdd�de�ZdS)
z"
Tests for L{twisted.web.script}.
�N)�FilePath)�TestCase)�	NOT_FOUND)�PythonScript�ResourceScriptDirectory)�_render)�DummyRequestc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ResourceScriptDirectoryTestsz/
    Tests for L{ResourceScriptDirectory}.
    cs<t����}tdg��t|��}��fdd�}|�|�|S)zh
        L{ResourceScriptDirectory.render} sets the HTTP response code to I{NOT
        FOUND}.
        �c����jt�dS�N��assertEqual�responseCoder��ignored��request�self��>/usr/lib/python3/dist-packages/twisted/web/test/test_script.py�
cbRendered �zDResourceScriptDirectoryTests.test_renderNotFound.<locals>.cbRendered)r�mktemprr�addCallback�r�resource�drrrr�test_renderNotFounds


z0ResourceScriptDirectoryTests.test_renderNotFoundcsV���}t�|�t|�}tdg��|�d��}t|��}��fdd�}|�|�|S)a
        L{ResourceScriptDirectory.getChild} returns a resource which renders an
        response with the HTTP I{NOT FOUND} status code if the indicated child
        does not exist as an entry in the directory used to initialized the
        L{ResourceScriptDirectory}.
        sfoo�foocrrr
rrrrr4rzCResourceScriptDirectoryTests.test_notFoundChild.<locals>.cbRendered)r�os�makedirsrr�getChildrr)r�pathr�childrrrrr�test_notFoundChild&s



z/ResourceScriptDirectoryTests.test_notFoundChildcslt����}|��|�d��d�t|���}tdg��|�d��}t	|��}��fdd�}|�
|�|S)��
        L{ResourceScriptDirectory.getChild} returns a resource which renders a
        response with the HTTP 200 status code and the content of the rpy's
        C{request} global.
        ztest.rpys�
from twisted.web.resource import Resource
class TestResource(Resource):
    isLeaf = True
    def render_GET(self, request):
        return b'ok'
resource = TestResource()r
stest.rpycs��d��j�d�dS)Nr
sok)r�join�writtenrrrrrP�z<ResourceScriptDirectoryTests.test_render.<locals>.cbRendered)rrr!r$�
setContentr�_asBytesPathrr"rr)r�tmprr$rrrrr�test_render:s
�	


z(ResourceScriptDirectoryTests.test_renderN)�__name__�
__module__�__qualname__�__doc__rr%r-rrrrr	s
r	c@s eZdZdZdd�Zdd�ZdS)�PythonScriptTestsz$
    Tests for L{PythonScript}.
    cs>t���d�}tdg��t|��}��fdd�}|�|�|S)z�
        If the source file a L{PythonScript} is initialized with doesn't exist,
        L{PythonScript.render} sets the HTTP response code to I{NOT FOUND}.
        Nr
crrr
rrrrrerz9PythonScriptTests.test_notFoundRender.<locals>.cbRendered)rrrrrrrrr�test_notFoundRender\s


z%PythonScriptTests.test_notFoundRendercsft����}|��|�d�}|�d�t|��d�}tdg��t|��}��fdd�}|�	|�|S)r&ztest.epysraise Exception("nooo")Nr
cs��dd��j��dS)Nsnooor
)�assertInr'r(rrrrryr)z:PythonScriptTests.test_renderException.<locals>.cbRendered)
rrr!r$r*rr+rrr)rr,r$rrrrrr�test_renderExceptionks




z&PythonScriptTests.test_renderExceptionN)r.r/r0r1r3r5rrrrr2Wsr2)r1r �twisted.python.filepathr�twisted.trial.unittestr�twisted.web.httpr�twisted.web.scriptrr�twisted.web.test._utilr�twisted.web.test.requesthelperrr	r2rrrr�<module>sE

Anon7 - 2022
AnonSec Team