+
    üÐjŸ  ã                   ó–   € R t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
HtHt ^ RIHt ^ RIHt  ! R	 R
]4      t ! R R]4      tR# )z"
Tests for L{twisted.web.script}.
N)Údefer)ÚFilePath)ÚTestCase)Ú	NOT_FOUND)ÚPythonScriptÚResourceScriptDirectory)Ú_render)ÚDummyRequestc                   óZ   a € ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltRtV t	R	# )
ÚResourceScriptDirectoryTestsz'
Tests for L{ResourceScriptDirectory}.
c                óB   <€ V ^8„  d   QhRS[ P                  R,          /# ©é   ÚreturnN©r   ÚDeferred)ÚformatÚ__classdict__s   "€Ú>/usr/lib/python3/dist-packages/twisted/web/test/test_script.pyÚ__annotate__Ú)ResourceScriptDirectoryTests.__annotate__   ó   ø€ ÷ )ñ )¡U§^¡^°DÕ%9ñ )ó    c                óž   a a€ \        S P                  4       4      p\        R.4      o\        VS4      pR VV 3R llpVP	                  V4      # )zP
L{ResourceScriptDirectory.render} sets the HTTP response code to I{NOT
FOUND}.
r   c                ó(   € V ^8„  d   QhR\         RR/# ©r   Úignoredr   N©Úobject)r   s   "r   r   ÚFResourceScriptDirectoryTests.test_renderNotFound.<locals>.__annotate__!   ó   € ÷ 	>ñ 	>¤ð 	>¨4ñ 	>r   c                 óH   <€ SP                  SP                  \        4       R # ©N©ÚassertEqualÚresponseCoder   ©r   ÚrequestÚselfs   &€€r   Ú
cbRenderedÚDResourceScriptDirectoryTests.test_renderNotFound.<locals>.cbRendered!   ó   ø€ Ø×Ñ˜W×1Ñ1´9Ö=r   )r   Úmktempr	   r   ÚaddCallback©r(   ÚresourceÚdr)   r'   s   f   @r   Útest_renderNotFoundÚ0ResourceScriptDirectoryTests.test_renderNotFound   sH   ù€ ô
 +¨4¯;©;«=Ó9ˆÜ ˜uÓ%ˆÜ�H˜gÓ&ˆ÷	>ñ 	>ð �}‰}˜ZÓ(Ð(r   c                óB   <€ V ^8„  d   QhRS[ P                  R,          /# r   r   )r   r   s   "€r   r   r   &   s   ø€ ÷ )ñ )¡E§N¡N°4Õ$8ñ )r   c                óò   a a€ S P                  4       p\        P                  ! V4       \        V4      p\	        R.4      oVP                  RS4      p\        VS4      pR VV 3R llpVP                  V4      # )zð
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Úfooc                ó(   € V ^8„  d   QhR\         RR/# r   r   )r   s   "r   r   ÚEResourceScriptDirectoryTests.test_notFoundChild.<locals>.__annotate__4   r    r   c                 óH   <€ SP                  SP                  \        4       R # r"   r#   r&   s   &€€r   r)   ÚCResourceScriptDirectoryTests.test_notFoundChild.<locals>.cbRendered4   r+   r   )r,   ÚosÚmakedirsr   r	   ÚgetChildr   r-   )r(   Úpathr/   Úchildr0   r)   r'   s   f     @r   Útest_notFoundChildÚ/ResourceScriptDirectoryTests.test_notFoundChild&   sk   ù€ ð �{‰{‹}ˆÜ
�Š�DÔÜ*¨4Ó0ˆÜ ˜xÓ(ˆØ×!Ñ! %¨Ó1ˆÜ�E˜7Ó#ˆ÷	>ñ 	>ð �}‰}˜ZÓ(Ð(r   c                óB   <€ V ^8„  d   QhRS[ P                  R,          /# r   r   )r   r   s   "€r   r   r   9   s   ø€ ÷ )ñ )™UŸ^™^¨DÕ1ñ )r   c                óT  a a€ \        S P                  4       4      pVP                  4        VP                  R4      P	                  R4       \        VP                  4       4      p\        R.4      oVP                  RS4      p\        VS4      pR VV 3R llpVP                  V4      # )úŸ
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.
ztest.rpys¬   
from twisted.web.resource import Resource
class TestResource(Resource):
    isLeaf = True
    def render_GET(self, request):
        return b'ok'
resource = TestResource()r   s   test.rpyc                ó(   € V ^8„  d   QhR\         RR/# r   r   )r   s   "r   r   Ú>ResourceScriptDirectoryTests.test_render.<locals>.__annotate__O   s   € ÷ 	?ñ 	?¤ð 	?¨4ñ 	?r   c                 ó^   <€ SP                  R P                  SP                  4      R4       R# )r   s   okN)r$   ÚjoinÚwrittenr&   s   &€€r   r)   Ú<ResourceScriptDirectoryTests.test_render.<locals>.cbRenderedO   s    ø€ Ø×Ñ˜SŸX™X g§o¡oÓ6¸Ö>r   )r   r,   r;   r>   Ú
setContentr   Ú_asBytesPathr	   r<   r   r-   )r(   Útmpr/   r>   r0   r)   r'   s   f     @r   Útest_renderÚ(ResourceScriptDirectoryTests.test_render9   s”   ù€ ô �t—{‘{“}Ó%ˆØ�‰ŒØ�	‰	�*Ó×(Ñ(ðô	
ô +¨3×+;Ñ+;Ó+=Ó>ˆÜ ˜uÓ%ˆØ×!Ñ! +¨wÓ7ˆÜ�E˜7Ó#ˆ÷	?ñ 	?ð �}‰}˜ZÓ(Ð(r   © N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r1   r?   rM   Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r      s(   ø‡ € ñ÷)ð )÷)ð )÷&)ö )r   r   c                   óH   a € ] tR t^Ut o RtV 3R lR ltV 3R lR ltRtV tR# )ÚPythonScriptTestsz
Tests for L{PythonScript}.
c                óB   <€ V ^8„  d   QhRS[ P                  R,          /# r   r   )r   r   s   "€r   r   ÚPythonScriptTests.__annotate__Z   r   r   c                ó    a a€ \        S P                  4       R4      p\        R.4      o\        VS4      pR VV 3R llpVP	                  V4      # )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   c                ó(   € V ^8„  d   QhR\         RR/# r   r   )r   s   "r   r   Ú;PythonScriptTests.test_notFoundRender.<locals>.__annotate__c   r    r   c                 óH   <€ SP                  SP                  \        4       R # r"   r#   r&   s   &€€r   r)   Ú9PythonScriptTests.test_notFoundRender.<locals>.cbRenderedc   r+   r   )r   r,   r	   r   r-   r.   s   f   @r   Útest_notFoundRenderÚ%PythonScriptTests.test_notFoundRenderZ   sJ   ù€ ô
   §¡£¨tÓ4ˆÜ ˜uÓ%ˆÜ�H˜gÓ&ˆ÷	>ñ 	>ð �}‰}˜ZÓ(Ð(r   c                óB   <€ V ^8„  d   QhRS[ P                  R,          /# r   r   )r   r   s   "€r   r   r[   h   s   ø€ ÷ )ñ )¡e§n¡n°TÕ&:ñ )r   c                ó6  a a€ \        S P                  4       4      pVP                  4        VP                  R4      pVP	                  R4       \        VP                  4       R4      p\        R.4      o\        VS4      pR VV 3R llpVP                  V4      # )rC   ztest.epys   raise Exception("nooo")Nr   c                ó(   € V ^8„  d   QhR\         RR/# r   r   )r   s   "r   r   Ú<PythonScriptTests.test_renderException.<locals>.__annotate__v   r    r   c                 ó^   <€ SP                  R RP                  SP                  4      4       R# )s   nooor   N)ÚassertInrG   rH   r&   s   &€€r   r)   Ú:PythonScriptTests.test_renderException.<locals>.cbRenderedv   s   ø€ Ø�M‰M˜' 3§8¡8¨G¯O©OÓ#<Ö=r   )
r   r,   r;   r>   rJ   r   rK   r	   r   r-   )r(   rL   r>   r/   r0   r)   r'   s   f     @r   Útest_renderExceptionÚ&PythonScriptTests.test_renderExceptionh   sƒ   ù€ ô �t—{‘{“}Ó%ˆØ�‰ŒØ—	‘	˜*Ó%ˆØ×ÑÐ3Ô4Ü × 2Ñ 2Ó 4°dÓ;ˆÜ ˜uÓ%ˆÜ�H˜gÓ&ˆ÷	>ñ 	>ð �}‰}˜ZÓ(Ð(r   rO   N)	rP   rQ   rR   rS   rT   ra   rj   rU   rV   rW   s   @r   rY   rY   U   s   ø‡ € ñ÷)ð )÷)ö )r   rY   )rT   r:   Útwisted.internetr   Útwisted.python.filepathr   Útwisted.trial.unittestr   Útwisted.web.httpr   Útwisted.web.scriptr   r   Útwisted.web.test._utilr   Útwisted.web.test.requesthelperr	   r   rY   rO   r   r   Ú<module>rs      s=   ðñó 
å "Ý ,Ý +Ý &ß DÝ *Ý 7ô?) 8ô ?)ôD$)˜ö $)r   