Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/protocols/haproxy/test/__pycache__/test_wrapper.cpython-39.pyc
Ðазад
a k�h�6 � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZm Z ddl mZ ddlmZ dd l mZ G d d� de �ZG dd � d ej�ZG dd� dej�ZdS )z> Test cases for L{twisted.protocols.haproxy.HAProxyProtocol}. � )�Optional)�mock)�address)�Factory�Protocol)� StringTransportWithDisconnection)�unittest� )�HAProxyWrappingFactoryc @ s. e Zd ZdZdd�dd�Zedd�dd�ZdS ) �StaticProtocolz6 Protocol stand-in that maintains test state. N��returnc C s d | _ d | _d| _d| _d S )N� F)�source�destination�dataZdisconnected)�self� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/protocols/haproxy/test/test_wrapper.py�__init__ s zStaticProtocol.__init__)r r c C s4 | j s J �| j �� | _| j �� | _| j|7 _d S )N)� transport�getPeerr �getHostr r )r r r r r �dataReceived s zStaticProtocol.dataReceived)�__name__� __module__�__qualname__�__doc__r �bytesr r r r r r s r c @ s� e Zd ZdZdd�dd�Zdd�dd�Zdd�dd �Zdd�d d�Zdd�dd �Zdd�dd�Z dd�dd�Z dd�dd�ZdS )�HAProxyWrappingFactoryV1Testsz] Test L{twisted.protocols.haproxy.HAProxyWrappingFactory} with v1 PROXY headers. Nr c C sR t t�t��}|�t�ddd��}t� }||_|� |� |� d� | �|j� dS )�J Test if invalid headers result in connectionLost events. �TCP� 127.1.1.1� s NOTPROXY anything can go here N� r r �forProtocolr � buildProtocolr �IPv4Addressr �protocol�makeConnectionr �assertFalse� connected�r �factory�protor r r r �test_invalidHeaderDisconnects) s � z;HAProxyWrappingFactoryV1Tests.test_invalidHeaderDisconnectsc C s\ t t�t��}|�t�ddd��}t� }||_|� |� |� d� |� d� | �|j� dS )r r! r"