/usr/local/lib64/python3.6/site-packages/flask/__pycache__
NameSizeModeActions
app.cpython-36.pyc628380644editdlrm
blueprints.cpython-36.pyc218950644editdlrm
cli.cpython-36.pyc268820644editdlrm
config.cpython-36.pyc115620644editdlrm
ctx.cpython-36.pyc154410644editdlrm
debughelpers.cpython-36.pyc63770644editdlrm
globals.cpython-36.pyc17420644editdlrm
helpers.cpython-36.pyc270040644editdlrm
logging.cpython-36.pyc24000644editdlrm
scaffold.cpython-36.pyc247450644editdlrm
sessions.cpython-36.pyc135440644editdlrm
signals.cpython-36.pyc23320644editdlrm
templating.cpython-36.pyc54490644editdlrm
testing.cpython-36.pyc90890644editdlrm
typing.cpython-36.pyc13630644editdlrm
views.cpython-36.pyc49100644editdlrm
wrappers.cpython-36.pyc49010644editdlrm
__init__.cpython-36.pyc18390644editdlrm
__main__.cpython-36.pyc1700644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/flask/__pycache__/testing.cpython-36.pyc (9089B)
3 ^TBgX*@sddlZddlmZddlmZddlmZddlZddl m Z ddlm Z ddl m Z ddlmZd d lmZd d lmZd d lmZd d lmZejrddlmZd dlmZGdddejjZGddde Z Gddde Z!dS)N)contextmanager)copy) TracebackType) CliRunner)Client) url_parse)Request) ScriptInfo)_request_ctx_stack)dumps) SessionMixin) TestResponse)Flaskc sbeZdZdZd deejeejeejeejejddfdd Zejejedd d Z Z S) EnvironBuilderaAn :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`. /Nr)apppathbase_url subdomain url_schemeargskwargsreturnc s|p |p | s*|dk t|p|ks*td|dkr|jjdp@d}|jd} |r^|d|}|dkrp|jd}t|} | jp|d| jp|d| jd}| j}| j rt | j t rd nd } || | j 7}||_ t j||f||dS) Nz8Cannot pass "subdomain" or "url_scheme" with "base_url".Z SERVER_NAME localhostZAPPLICATION_ROOT.ZPREFERRED_URL_SCHEMEz://r??)boolAssertionErrorconfiggetrschemenetloclstriprquery isinstancebytesrsuper__init__) selfrrrrrrrZ http_hostZapp_rooturlsep) __class__./tmp/pip-build-0s3hx122/flask/flask/testing.pyr)-s(   &zEnvironBuilder.__init__)objrrcKs|jd|jt|f|S)zSerialize ``obj`` to a JSON-formatted string. The serialization will be configured according to the config associated with this EnvironBuilder's ``app``. r) setdefaultr json_dumps)r*r0rr.r.r/r2UszEnvironBuilder.json_dumps)rNNN) __name__ __module__ __qualname____doc__strtOptionalAnyr)r2 __classcell__r.r.)r-r/rsrcseZdZUdZddZejejddfdd Ze ejejej e ddfddd Z ddd eje e ejd d fd dZddddZeeeddddZZS) FlaskClientaEWorks 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 :doc:`/testing` chapter. rFN)rrrcs&tj||ddtjd|_dS)Nz 127.0.0.1z werkzeug/)Z REMOTE_ADDRZHTTP_USER_AGENT)r(r)werkzeug __version__ environ_base)r*rr)r-r.r/r)qszFlaskClient.__init__c os|jdkrtd|j}|jdi}|jj|tj}|j||}|j}|j ||j }|dkrhtdtj |z |VWdtj X|j } |j|s|j||| | j|j j} |jj|j j| WdQRXdS)aWhen 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)Z cookie_jar RuntimeError applicationr1Z inject_wsgir topZtest_request_contextsession_interfaceZ open_sessionrequestpushpopresponse_classZis_null_sessionZ save_sessionZget_wsgi_headersenvironZ extract_wsgi) r*rrrr@Z outer_reqctxcrDsessrespheadersr.r.r/session_transactionxs,       zFlaskClient.session_transaction)bufferedfollow_redirectsr)rrOrPrrc s<|jdd}d}fdd}| rt|dkr|d}t|tjjrft|} || jpVi| _| j}nDt|t rtj |j |idj}nt|t rt|}||j |_ |dkr||jdi|d<tj f||} z | j}Wd| jX|dk r&ddl} | jdtd d tj||||d Stj|||d SdS) Nas_tuplecsj|djiS)Nzflask._preserve_context)r?preserve_context)other)r*r.r/ copy_environsz&FlaskClient.open..copy_environr r)rr?r?zs'as_tuple' is deprecated and will be removed in Werkzeug 2.1 and Flask 2.1. Use 'response.request.environ' instead.) stacklevel)rQrOrP)rOrP)rGlenr&r=testrrr? get_requestdictZ from_environrB BaseRequestrIr!closewarningswarnDeprecationWarningr(open) r*rOrPrrrQrErTargZbuilderr])r-)r*r/r`sH         zFlaskClient.open)rcCs|jrtdd|_|S)NzCannot nest client invocationsT)rRrA)r*r.r.r/ __enter__szFlaskClient.__enter__)exc_type exc_valuetbrcCs0d|_x$tj}|dk r&|jr&|jqPqWdS)NF)rRr rCZ preservedrG)r*rcrdrerCr.r.r/__exit__s  zFlaskClient.__exit__)r3r4r5r6rBrRr8r:r)r Generatorr rNrr`rbtype BaseExceptionrrfr;r.r.)r-r/r<_s 7<r<csNeZdZdZdejddfdd Zd ejejejejdfdd ZZS) FlaskCliRunnerzA :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`. rN)rrrc s||_tjf|dS)N)rr(r))r*rr)r-r.r/r)szFlaskCliRunner.__init__)clirrrc s@|dkrjj}d|kr.tfddd|d<tj||f|S)acInvokes a CLI command in an isolated environment. See :meth:`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. Nr0csjS)N)rr.)r*r.r/(sz'FlaskCliRunner.invoke..)Z create_app)rrkr r(invoke)r*rkrr)r-)r*r/rms zFlaskCliRunner.invoke)NN) r3r4r5r6r8r:r)rmr;r.r.)r-r/rj srj)"Ztypingr8 contextlibrrtypesrZ werkzeug.testr=Z click.testingrrZ werkzeug.urlsrZwerkzeug.wrappersrr[rkr globalsr jsonr r2sessionsr Z TYPE_CHECKINGrrrrXrr<rjr.r.r.r/s&             H+