Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/web/test/__pycache__/test_proxy.cpython-39.pyc
Ðазад
a k�hNN � @ s� d Z ddlmZmZ ddlmZ ddlmZmZm Z m Z mZ ddlm Z ddlmZ ddlmZ G dd � d e�ZG d d� d�ZG dd � d e�ZG dd� de�ZG dd� de�ZG dd� d�ZG dd� de�ZdS )z Test for L{twisted.web.proxy}. � )� MemoryReactor� StringTransportWithDisconnection)�TestCase)�ProxyClient�ProxyClientFactory�ProxyRequest�ReverseProxyRequest�ReverseProxyResource)�Resource)�Site��DummyRequestc @ s@ e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dS )�ReverseProxyResourceTestsz, Tests for L{ReverseProxyResource}. c C s� t � }t� }tddd|�}|�d|� t|�}t� }|�d�}|�|� | �|j d� |� d| d � |j\\} } }}} | �| d� | �| d� | � |t� | �|j|� | �|jd d � dS ) z� Check that a request pointing at C{uri} produce a new proxy connection, with the path of this request pointing at C{expectedURI}. � 127.0.0.1�� � /paths indexNs GET s HTTP/1.1 Accept: text/html � hosts 127.0.0.1:1234)r r r ZputChildr r � buildProtocol�makeConnectionZ addCleanup�connectionLost�dataReceived� tcpClients�assertEqual�assertIsInstancer �rest�headers)�self�uri�expectedURI�root�reactor�resource�site� transport�channel�host�port�factory�_timeoutZ _bind_addr� r) ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/web/test/test_proxy.py�_testRender s z%ReverseProxyResourceTests._testRenderc C s | � dd�S )z� Test that L{ReverseProxyResource.render} initiates a connection to the given server with a L{ProxyClientFactory} as parameter. s /indexr �r+ �r r) r) r* �test_render8 s z%ReverseProxyResourceTests.test_renderc C s | � dd�S )z� Test that L{ReverseProxyResource.render} will instantiate a child resource that will initiate a connection to the given server requesting the apropiate url subpath. s /index/page1s /path/page1r, r- r) r) r* �test_render_subpage? s z-ReverseProxyResourceTests.test_render_subpagec C s | � dd�S )zr Test that L{ReverseProxyResource.render} passes query parameters to the created factory. s /index?foo=bars /path?foo=barr, r- r) r) r* �test_renderWithQueryG s z.ReverseProxyResourceTests.test_renderWithQueryc C sj t � }tddd|�}|�dd�}| �|t� | �|jd� | �|jd� | �|jd� | �|j |j � dS )a The L{ReverseProxyResource.getChild} method should return a resource instance with the same class as the originating resource, forward port, host, and reactor values, and update the path value with the value passed. r r r � fooNs /path/foo) r r �getChildr r �pathr&