File: //lib/python3/dist-packages/twisted/protocols/haproxy/test/__pycache__/test_v1parser.cpython-38.pyc
U
W[V � @ sR d Z ddlmZ ddlmZ ddlmZmZmZ ddl m
Z
G dd� dej�Zd S )
z7
Test cases for L{twisted.protocols.haproxy.V1Parser}.
� )�unittest)�address� )�InvalidProxyHeader�InvalidNetworkProtocol�MissingAddressData)� _v1parserc @ s` e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� Z
dS )�
V1ParserTestsz?
Test L{twisted.protocols.haproxy.V1Parser} behaviour.
c C s | � ttjjd� dS )zT
Test that an exception is raised when the PROXY header is missing.
s NOTPROXY N)�assertRaisesr r �V1Parser�parse��self� r �N/usr/lib/python3/dist-packages/twisted/protocols/haproxy/test/test_v1parser.py�test_missingPROXYHeaderValue s
�z*V1ParserTests.test_missingPROXYHeaderValuec C s | � ttjjd� dS )zX
Test that an exception is raised when the proto is not TCP or UNKNOWN.
s PROXY WUTPROTO N)r
r r r r r
r r r �test_invalidNetworkProtocol! s
�z)V1ParserTests.test_invalidNetworkProtocolc C s | � ttjjd� dS )zU
Test that an exception is raised when the proto has no source data.
s PROXY TCP4 N�r
r r r r r
r r r �test_missingSourceData, s
�z$V1ParserTests.test_missingSourceDatac C s | � ttjjd� dS )zU
Test that an exception is raised when the proto has no destination.
s PROXY TCP4 127.0.0.1 8080 8888Nr r
r r r �test_missingDestData7 s
�z"V1ParserTests.test_missingDestDatac C s` t j�d�}| �|jtj� | �|jjd� | �|jj d� | �|j
jd� | �|j
j d� dS )zE
Test that parsing is successful for a PROXY header.
s( PROXY TCP4 127.0.0.1 127.0.0.1 8080 8888� 127.0.0.1� �"