§
    ùÛgí  ã                   óˆ   — d Z ddlmZ ddlmZmZ ddlmZ 	 ddlm	Z	 n# e
$ r	 ddlmZ	 Y nw xY wdd	„Z G d
„ de¦  «        ZdS )zþ
    flask.testing
    ~~~~~~~~~~~~~

    Implements test support helpers.  This module is lazily imported
    and usually not used in production environments.

    :copyright: (c) 2015 by Armin Ronacher.
    :license: BSD, see LICENSE for more details.
é    )Úcontextmanager)ÚClientÚEnvironBuilder)Ú_request_ctx_stack)Ú	url_parse)Úurlsplitú/Nc                 óB  — | j                              d¦  «        }| j                              d¦  «        }|€Yt          |¦  «        }d|j        p|pdz  }|r||                     d¦  «        z  }|j        r|j        }|j        r|d|j        z   z  }t          ||g|¢R i |¤ŽS )zDCreates a new test builder with some application defaults thrown in.ÚSERVER_NAMEÚAPPLICATION_ROOTNz
http://%s/Ú	localhostr	   ú?)ÚconfigÚgetr   ÚnetlocÚlstripÚpathÚqueryr   )Úappr   Úbase_urlÚargsÚkwargsÚ	http_hostÚapp_rootÚurls           úC/granary/edev/quantum/lib/python3.11/site-packages/flask/testing.pyÚmake_test_environ_builderr      s¹   € à”
—’˜}Ñ-Ô-€IØŒz�~Š~Ð0Ñ1Ô1€HØÐÝ˜‰oŒoˆØ 3¤:Ð#I°Ð#I¸kÑJˆØð 	-Ø˜Ÿš¨Ñ,Ô,Ñ,ˆHØŒ:ð 	(Ø”8ˆDØŒyð (Ø˜˜cœi™Ñ'�Ý˜$ Ð:¨4Ð:Ð:Ð:°6Ð:Ð:Ð:ó    c                   ó>   — e Zd ZdZdZed„ ¦   «         Zd„ Zd„ Zd„ Z	dS )ÚFlaskClientaw  Works like a regular Werkzeug test client but has some knowledge about
    how Flask works to defer the cleanup of the request context stack to the
    end of a ``with`` body when used in a ``with`` statement.  For general
    information about how to use this class refer to
    :class:`werkzeug.test.Client`.

    Basic usage is outlined in the :ref:`testing` chapter.
    Fc              /   óø  K  — | j         €t          d¦  «        ‚| j        }|                     di ¦  «        }| j                              |¦  «         t
          j        } |j        |i |¤Ž5 }|                     |j	        ¦  «        }|€t          d¦  «        ‚t          j
        |¦  «         	 |V — t          j        ¦   «          n# t          j        ¦   «          w xY w|                     ¦   «         }|j                             |¦  «        s|                     ||¦  «         |                     |j	        j        ¦  «        }	| j                              |j	        j        |	¦  «         ddd¦  «         dS # 1 swxY w Y   dS )a’  When used in combination with a ``with`` statement this opens a
        session transaction.  This can be used to modify the session that
        the test client uses.  Once the ``with`` block is left the session is
        stored back.

        ::

            with client.session_transaction() as session:
                session['value'] = 42

        Internally this is implemented by going through a temporary test
        request context and since session handling could depend on
        request variables this function accepts the same arguments as
        :meth:`~flask.Flask.test_request_context` which are directly
        passed through.
        Nz:Session transactions only make sense with cookies enabled.Úenviron_overridesz?Session backend did not open a session. Check the configuration)Ú
cookie_jarÚRuntimeErrorÚapplicationÚ
setdefaultÚinject_wsgir   ÚtopÚtest_request_contextÚopen_sessionÚrequestÚpushÚpopÚresponse_classÚsession_interfaceÚis_null_sessionÚsave_sessionÚget_wsgi_headersÚenvironÚextract_wsgi)
Úselfr   r   r   r"   Úouter_reqctxÚcÚsessÚrespÚheaderss
             r   Úsession_transactionzFlaskClient.session_transaction3   sà  è è € ð$ Œ?Ð"Ýð  7ñ 8ô 8ð 8àÔˆØ"×-Ò-Ð.AÀ2ÑFÔFÐØŒ×#Ò#Ð$5Ñ6Ô6Ð6Ý)Ô-ˆØ%ˆSÔ% tÐ6¨vÐ6Ð6ð 	E¸!Ø×#Ò# A¤IÑ.Ô.ˆDØˆ|Ý"ð $=ñ >ô >ð >õ Ô# LÑ1Ô1Ð1ð)Ø�
�
�
å"Ô&Ñ(Ô(Ð(Ð(øÕ"Ô&Ñ(Ô(Ð(Ð(øøøà×%Ò%Ñ'Ô'ˆDØÔ(×8Ò8¸Ñ>Ô>ð -Ø× Ò   tÑ,Ô,Ð,Ø×+Ò+¨A¬IÔ,=Ñ>Ô>ˆGØŒO×(Ò(¨¬Ô):¸GÑDÔDÐDð/	Eð 	Eð 	Eñ 	Eô 	Eð 	Eð 	Eð 	Eð 	Eð 	Eð 	Eð 	Eøøøð 	Eð 	Eð 	Eð 	Eð 	Eð 	Es,   Á)A E/Â*CÂ.E/ÃCÃBE/Å/E3Å6E3c                 ó  — | j         |                     di ¦  «        d<   |                     dd¦  «        }|                     dd¦  «        }|                     dd¦  «        }t          | j        g|¢R i |¤Ž}t          j        | ||||¬¦  «        S )Nr"   zflask._preserve_contextÚas_tupleFÚbufferedÚfollow_redirects)r=   r>   r?   )Úpreserve_contextr&   r-   r   r%   r   Úopen)r5   r   r   r=   r>   r?   Úbuilders          r   rA   zFlaskClient.opene   s©   € à*.Ô*?ð 	×ÒÐ-¨rÑ2Ô2Ø&ñ	(ð —:’:˜j¨%Ñ0Ô0ˆØ—:’:˜j¨%Ñ0Ô0ˆØ!Ÿ:š:Ð&8¸%Ñ@Ô@ÐÝ+¨DÔ,<ÐN¸tÐNÐNÐNÀvÐNÐNˆåŒ{˜4 Ø$,Ø$,Ø,<ð>ñ >ô >ð 	>r   c                 ó@   — | j         rt          d¦  «        ‚d| _         | S )NzCannot nest client invocationsT)r@   r$   )r5   s    r   Ú	__enter__zFlaskClient.__enter__s   s*   € ØÔ ð 	AÝÐ?Ñ@Ô@Ð@Ø $ˆÔØˆr   c                 ón   — d| _         t          j        }|�|j        r|                     ¦   «          d S d S d S )NF)r@   r   r(   Ú	preservedr-   )r5   Úexc_typeÚ	exc_valueÚtbr(   s        r   Ú__exit__zFlaskClient.__exit__y   s;   € Ø %ˆÔõ
 !Ô$ˆØˆ?˜sœ}ˆ?Ø�GŠG‰IŒIˆIˆIˆIð ˆ?ˆ?ˆ?r   N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r@   r   r;   rA   rD   rJ   © r   r   r    r    '   sp   € € € € € ðð ð Ðàð/Eð /Eñ „^ð/Eðb>ð >ð >ðð ð ðð ð ð ð r   r    )r	   N)rN   Ú
contextlibr   Úwerkzeug.testr   r   Úflaskr   Úwerkzeug.urlsr   ÚImportErrorÚurlparser   r   r    rO   r   r   ú<module>rV      sì   ðð	ð 	ð &Ð %Ð %Ð %Ð %Ð %Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø $Ð $Ð $Ð $Ð $Ð $ð/Ø'Ð'Ð'Ð'Ð'Ð'Ð'øØð /ð /ð /Ø.Ð.Ð.Ð.Ð.Ð.Ð.Ð.ð/øøøð;ð ;ð ;ð ;ð Zð Zð Zð Zð Z�&ñ Zô Zð Zð Zð Zs   ˜ Ÿ-¬-