HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/cheroot/__pycache__/testing.cpython-310.pyc
o

�N�gL�@sdZddlmZmZmZeZddlmZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlZddlmZddlZdZdZdZdZejjeefdd	�ejjeefejjd
�iZdd�Ze
j d
d��Z!e
j dd��Z"Gdd�d�Z#dd�Z$dd�Z%dd�Z&dS)zAPytest fixtures and other helpers for doing testing by end-users.�)�absolute_import�division�print_function)�closingN)�http_client)�webtestz0.0.0.0z::)�	bind_addrZwsgi_app)rZgatewayc	cs��t|��}|�d�d}ttfD]}z||f}|dd|i|��}Wn	ty,Yqwd|_tj|j	d��
�|jsEt�
d�|jr=|V|��dS)z/Set up and tear down a Cheroot server instance.r���r)�targetg�������?N�)�config�copy�pop�ANY_INTERFACE_IPV6�ANY_INTERFACE_IPV4�OSErrorZshutdown_timeout�	threading�ThreadZ
safe_start�start�ready�time�sleep�stop)Zserver_factoryZconfZ	bind_port�	interfaceZactual_bind_addrZ
httpserverrr�C/opt/saltstack/salt/lib/python3.10/site-packages/cheroot/testing.py�cheroot_server$s,��
��
�rcc��ttjj�D]}|VqdS)z4Set up and tear down a Cheroot WSGI server instance.N)r�cheroot�wsgi�Server�Zsrvrrr�wsgi_server@���r!ccr)z4Set up and tear down a Cheroot HTTP server instance.N)rr�server�
HTTPServerr rrr�
native_serverGr"r%c@s2eZdZdd�Zdd�Z		ddd	�Zd
d�ZdS)
�_TestClientcCs*t|j�\|_|_|_||_|��|_dS)N)�_get_conn_datar�
_interface�_host�_port�server_instance�get_connection�_http_connection)�selfr#rrr�__init__Os
�z_TestClient.__init__cCs2dj|j|jd�}|jjdurtjntj}||�S)Nz{interface}:{port})r�port)�formatr(r*r+Zssl_adapterr�HTTPConnection�HTTPSConnection)r.�nameZconn_clsrrrr,Vs���z_TestClient.get_connection�GETN�HTTP/1.1c	Cs"tj||||j|j|p
|j|d�S)N)�method�headers�hostr0�	http_conn�protocol)rZopenURLr)r*r-)r.�urir7r8r:r;rrr�requestbs�z_TestClient.requestcs��fdd�}|S)Ncs���}�j|fd|i|��S)Nr7)�upperr=)r<�kwargsZhttp_method��	attr_namer.rr�_wrapperosz)_TestClient.__getattr__.<locals>._wrapperr)r.rArBrr@r�__getattr__nsz_TestClient.__getattr__)r5NNr6)�__name__�
__module__�__qualname__r/r,r=rCrrrrr&Ns

�r&c
Cs�z%ttjtjd���}|�|df�Wd�WdS1swYWdSttjfyB}z|jtjkr7�WYd}~dSd}~ww)N)�familyrTF)r�socket�AF_INET6�bindr�error�errnoZ
EADDRNOTAVAIL)r�sockZsock_errrrr�_probe_ipv6_sockvs���
���rNcCsRt|t�r
|\}}n|d}}t�|�}d|vr$t|�s$d}d|vr$|}|||fS)Nr�:z	127.0.0.1)�
isinstance�tuplerrrN)rr9r0rrrrr'�s




r'cCst|�S)z5Create and return a test client for the given server.)r&)r#rrr�get_server_client�srR)'�__doc__Z
__future__rrr�typeZ
__metaclass__�
contextlibrrLrHrrZpytestZ	six.movesrZcheroot.serverrZcheroot.testrZcheroot.wsgiZEPHEMERAL_PORTZNO_INTERFACErrrrr#r$ZGatewayrrZfixturer!r%r&rNr'rRrrrr�<module>sF���

(