https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/flask/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/flask/testing.pyc
�
-/�_c@s�dZddlZddlmZddlZddlmZddlmZddl	m
Z
ddlmZdd	l
mZdd
lmZdejjfd��YZd
�Zdefd��YZdefd��YZdS(s�
    flask.testing
    ~~~~~~~~~~~~~

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

    :copyright: 2010 Pallets
    :license: BSD-3-Clause
i����N(tcontextmanager(t	CliRunner(tClient(t	url_parsei(t_request_ctx_stack(t
ScriptInfo(tdumpstEnvironBuildercBs,eZdZddddd�Zd�ZRS(s�An :class:`~werkzeug.test.EnvironBuilder`, that takes defaults from the
    application.

    :param app: The Flask application to configure the environment from.
    :param path: URL path being requested.
    :param base_url: Base URL where the app is being served, which
        ``path`` is relative to. If not given, built from
        :data:`PREFERRED_URL_SCHEME`, ``subdomain``,
        :data:`SERVER_NAME`, and :data:`APPLICATION_ROOT`.
    :param subdomain: Subdomain name to append to :data:`SERVER_NAME`.
    :param url_scheme: Scheme to use instead of
        :data:`PREFERRED_URL_SCHEME`.
    :param json: If given, this is serialized as JSON and passed as
        ``data``. Also defaults ``content_type`` to
        ``application/json``.
    :param args: other positional arguments passed to
        :class:`~werkzeug.test.EnvironBuilder`.
    :param kwargs: other keyword arguments passed to
        :class:`~werkzeug.test.EnvironBuilder`.
    t/cOs]|p|p|s=|dk	t|p(|�ks=td��|dkr1|jjd�p^d}|jd}	|r�dj||�}n|dkr�|jd}nt|�}
djd|
jp�|d	|
jp�|d
|	j	d��}|
j
}|
jr1t|
jt
�rdnd}|||
j7}q1n||_tt|�j||||�dS(
Ns8Cannot pass "subdomain" or "url_scheme" with "base_url".tSERVER_NAMEt	localhosttAPPLICATION_ROOTs{0}.{1}tPREFERRED_URL_SCHEMEs{scheme}://{netloc}/{path}tschemetnetloctpathRt?(tNonetbooltAssertionErrortconfigtgettformatRR
RtlstripRtqueryt
isinstancetbytestapptsuperRt__init__(tselfRRtbase_urlt	subdomaint
url_schemetargstkwargst	http_hosttapp_rootturltsep((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyR/s.
		
				cKs |jd|j�t||�S(s�Serialize ``obj`` to a JSON-formatted string.

        The serialization will be configured according to the config associated
        with this EnvironBuilder's ``app``.
        R(t
setdefaultRt
json_dumps(RtobjR#((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyR)XsN(t__name__t
__module__t__doc__RRR)(((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyRs#cOs tjtd��t||�S(s�Create a :class:`flask.testing.EnvironBuilder`.

    .. deprecated: 1.1
        Will be removed in 2.0. Construct
        ``flask.testing.EnvironBuilder`` directly instead.
    s�"make_test_environ_builder()" is deprecated and will be removed in 2.0. Construct "flask.testing.EnvironBuilder" directly instead.(twarningstwarntDeprecationWarningR(R"R#((s./tmp/pip-install-sTXtzD/flask/flask/testing.pytmake_test_environ_builderbs
tFlaskClientcBsGeZdZeZd�Zed��Zd�Zd�Z	d�Z
RS(sDWorks 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`.

    .. versionchanged:: 0.12
       `app.test_client()` includes preset default environment, which can be
       set after instantiation of the `app.test_client()` object in
       `client.environ_base`.

    Basic usage is outlined in the :ref:`testing` chapter.
    cOs;tt|�j||�idd6dtjd6|_dS(Ns	127.0.0.1tREMOTE_ADDRs	werkzeug/tHTTP_USER_AGENT(RR2Rtwerkzeugt__version__tenviron_base(RR"R#((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyR�scos-|jdkrtd��n|j}|jdi�}|jj|�tj}|j||���}|j	}|j
||j�}|dkr�td��ntj|�z	|VWdtj
�X|j�}	|j|�s�|j|||	�n|	j|jj�}
|jj|jj|
�WdQXdS(s�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.
        s:Session transactions only make sense with cookies enabled.tenviron_overridess?Session backend did not open a session. Check the configurationN(t
cookie_jarRtRuntimeErrortapplicationR(tinject_wsgiRttopttest_request_contexttsession_interfacetopen_sessiontrequesttpushtpoptresponse_classtis_null_sessiontsave_sessiontget_wsgi_headerstenvirontextract_wsgi(RR"R#RR8touter_reqctxtcR?tsesstresptheaders((s./tmp/pip-install-sTXtzD/flask/flask/testing.pytsession_transaction�s,			

	cOsR|jdt�}|jdt�}|jdt�}|r�t|�dkr�t|dtjjtf�r�|jj	�}t|dtjj�r�|j
|dj��n|j
|d�|j|d<n_|j|j
di�d<|j
d|j�t|j||�}z|j�}Wd|j�Xtj||d|d|d|�S(	Ntas_tupletbufferedtfollow_redirectsiisflask._preserve_contextR8R7(RCtFalsetlenRR5ttestRtdictR7tcopytupdatetget_environtpreserve_contextR(R;tcloseRtopen(RR"R#RPRQRRRHtbuilder((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyR\�s.cCs%|jrtd��nt|_|S(NsCannot nest client invocations(RZR:tTrue(R((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyt	__enter__�s		cCsFt|_x6trAtj}|dk	r=|jr=|j�qPqWdS(N(RSRZR^RR=Rt	preservedRC(Rtexc_typet	exc_valuettbR=((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyt__exit__�s			
(R+R,R-RSRZRRROR\R_Rd(((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyR2ss
	5	&	tFlaskCliRunnercBs&eZdZd�Zddd�ZRS(s�A :class:`~click.testing.CliRunner` for testing a Flask app's
    CLI commands. Typically created using
    :meth:`~flask.Flask.test_cli_runner`. See :ref:`testing-cli`.
    cKs#||_tt|�j|�dS(N(RRReR(RRR#((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyRs	csb|dkr�jj}nd|krFtd�fd��|d<ntt��j|||�S(scInvokes a CLI command in an isolated environment. See
        :meth:`CliRunner.invoke <click.testing.CliRunner.invoke>` for
        full method documentation. See :ref:`testing-cli` for examples.

        If the ``obj`` argument is not given, passes an instance of
        :class:`~flask.cli.ScriptInfo` that knows how to load the Flask
        app being tested.

        :param cli: Command object to invoke. Default is the app's
            :attr:`~flask.app.Flask.cli` group.
        :param args: List of strings to invoke the command with.

        :return: a :class:`~click.testing.Result` object.
        R*t
create_appcs�jS(N(R((R(s./tmp/pip-install-sTXtzD/flask/flask/testing.pyt<lambda>sN(RRtcliRRRetinvoke(RRhR"R#((Rs./tmp/pip-install-sTXtzD/flask/flask/testing.pyRis
N(R+R,R-RRRi(((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyRe�s	(R-R.t
contextlibRt
werkzeug.testR5t
click.testingRRt
werkzeug.urlsRtRRhRtjsonRR)RURR1R2Re(((s./tmp/pip-install-sTXtzD/flask/flask/testing.pyt<module>sI	�

https://t.me/AnonymousX5 - 2025