a
    m¬zfh
  ã                   @   sb   d Z ddlZddlZddlmZmZ ej dd¡dd„ ƒZej	dd	„ ƒZ
ej d
d¡dd„ ƒZdS )zCTests to verify the command line interface.

.. spelling::

   cli
é    N)ÚApplicationÚparse_wsgi_bind_addr©Zraw_bind_addrZexpected_bind_addr)	)z192.168.1.1:80)z192.168.1.1éP   )z
[::1]:8000)z::1i@  )zlocalhost:5000)Ú	localhostéˆ  )zfoo@bar:5000)Úbarr   )Úfoo)r	   N)Ú	123456789)r
   N)ú/tmp/cheroot.sockr   )ú/tmp/some-random-file-namer   )z@cherootz cherootc                 C   s   t | ƒ|ksJ ‚dS )zwCheck the parsing of the --bind option.

    Verify some of the supported addresses and the expected return value.
    N)r   r   © r   úC/var/www/media/lib/python3.9/site-packages/cheroot/test/test_cli.pyÚtest_parse_wsgi_bind_addr   s    r   c                 C   s(   G dd„ dƒ}|ƒ }|   tjd|¡ |S )zReturn a WSGI app stub.c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )zwsgi_app.<locals>.WSGIAppMockzMock of a wsgi module.c                 S   s   dS )a3  Empty application method.

            Default method to be called when no specific callable
            is defined in the wsgi application identifier.

            It has an empty body because we are expecting to verify that
            the same method is return no the actual execution of it.
            Nr   ©Úselfr   r   r   Úapplication2   s    z)wsgi_app.<locals>.WSGIAppMock.applicationc                 S   s   dS )zÖEmpty custom method (callable) inside the mocked WSGI app.

            It has an empty body because we are expecting to verify that
            the same method is return no the actual execution of it.
            Nr   r   r   r   r   Úmain<   s    z"wsgi_app.<locals>.WSGIAppMock.mainN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   ÚWSGIAppMock/   s   
r   ú
mypkg.wsgi)ÚsetitemÚsysÚmodules)Zmonkeypatchr   Zappr   r   r   Úwsgi_app,   s    r   )Úapp_nameÚ
app_method))Nr   )r   r   )r   r   c                 C   sB   | du rd}ndj f i tƒ ¤Ž}t||ƒ}t |¡j|ks>J ‚dS )z+Check the wsgi application name conversion.Nr   zmypkg.wsgi:{app_name})ÚformatÚlocalsÚgetattrr   Úresolver   )r   r   r   Zwsgi_app_specZexpected_appr   r   r   Útest_Aplication_resolveI   s
    
r$   )r   r   ZpytestZcheroot.clir   r   ÚmarkZparametrizer   Zfixturer   r$   r   r   r   r   Ú<module>   s   þ

þ	