Current File : //proc/self/root/lib/python3/dist-packages/twisted/web/test/__pycache__/test_script.cpython-312.pyc |
�
Ϫ�f� � � � d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z ddl
mZmZ ddl
mZ dd lmZ G d
� de� Z G d� d
e� Zy)z"
Tests for L{twisted.web.script}.
� N)�defer)�FilePath)�TestCase)� NOT_FOUND)�PythonScript�ResourceScriptDirectory)�_render)�DummyRequestc � � e Zd ZdZdej
d fd�Zdej
d fd�Zdej
d fd�Zy)�ResourceScriptDirectoryTestsz/
Tests for L{ResourceScriptDirectory}.
�returnNc � � �� t � j � � }t dg� �t |�� }dt ddf�� fd�}|j |� S )zh
L{ResourceScriptDirectory.render} sets the HTTP response code to I{NOT
FOUND}.
� �ignoredr
Nc �F �� �j �j t � y �N��assertEqual�responseCoder �r �request�selfs ���>/usr/lib/python3/dist-packages/twisted/web/test/test_script.py�
cbRenderedzDResourceScriptDirectoryTests.test_renderNotFound.<locals>.cbRendered! � �� ����W�1�1�9�=r )r �mktempr
r �object�addCallback�r �resource�dr r s ` @r �test_renderNotFoundz0ResourceScriptDirectoryTests.test_renderNotFound sQ �� �
+�4�;�;�=�9����u�%���H�g�&�� >�� >�4� >� �}�}�Z�(�(r c � � �� � j � }t j |� t |� }t dg� �|j d�� }t
|�� }dt ddf�� fd�}|j |� 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}.
s foo�foor r
Nc �F �� �j �j t � y r r r s ��r r zCResourceScriptDirectoryTests.test_notFoundChild.<locals>.cbRendered4 r r ) r �os�makedirsr r
�getChildr r r )r �pathr �childr! r r s ` @r �test_notFoundChildz/ResourceScriptDirectoryTests.test_notFoundChild&