Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/flask/__pycache__/testing.cpython-37.pyc

136 lines
8.5 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
<00>/<2F>]<5D>'<00>@s<>dZddlZddlmZddlZddlmZddlmZddl m
Z
ddl m Z dd l mZdd
lmZGd d <0C>d ejj<13>Zd d<0E>ZGdd<10>de<08>ZGdd<12>de<07>ZdS)z<>
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
<EFBFBD>N)<01>contextmanager)<01> CliRunner)<01>Client)<01> url_parse<73>)<01>_request_ctx_stack)<01>
ScriptInfo)<01>dumpscs*eZdZdZd<08>fdd<05> Zdd<07>Z<05>ZS) <09>EnvironBuildera<72>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`.
<20>/Nc s<>|s |s |r(|dk t|p|<05>ks(td<01><01>|dkr<>|j<02>d<02>p>d}|jd} |rZd<05>||<08>}|dkrl|jd}t|<02>}
dj|
jp<>||
jp<>|| <09>d<08>d <09>}|
j }|
j
r<EFBFBD>t |
j
t <0C>r<>d
nd } || |
j
7}||_ tt|<00>j||f|<06>|<07>dS) Nz8Cannot pass "subdomain" or "url_scheme" with "base_url".Z SERVER_NAME<4D> localhostZAPPLICATION_ROOTz{0}.{1}ZPREFERRED_URL_SCHEMEz{scheme}://{netloc}/{path}r )<03>scheme<6D>netloc<6F>path<74>?<3F>?)<11>bool<6F>AssertionError<6F>config<69>get<65>formatrr r<00>lstripr<00>query<72>
isinstance<EFBFBD>bytes<65>app<70>superr
<00>__init__) <0C>selfrr<00>base_urlZ subdomainZ
url_scheme<EFBFBD>args<67>kwargsZ http_hostZapp_root<6F>url<72>sep)<01> __class__<5F><00>0/tmp/pip-install-c3kgu56x/Flask/flask/testing.pyr/s.

 
zEnvironBuilder.__init__cKs|<02>d|j<01>t|f|<02>S)z<>Serialize ``obj`` to a JSON-formatted string.
The serialization will be configured according to the config associated
with this EnvironBuilder's ``app``.
r)<03>
setdefaultr<00>
json_dumps)r<00>objr!r%r%r&r(XszEnvironBuilder.json_dumps)r NNN)<07>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rr(<00> __classcell__r%r%)r$r&r
s #r
cOst<00>td<01><01>t||<01>S)z<>Create a :class:`flask.testing.EnvironBuilder`.
.. deprecated: 1.1
Will be removed in 1.2. Construct ``flask.testing.EnvironBuilder``
directly instead.
z<>"make_test_environ_builder()" is deprecated and will be removed in 1.2. Construct "flask.testing.EnvironBuilder" directly instead.)<04>warnings<67>warn<72>DeprecationWarningr
)r r!r%r%r&<00>make_test_environ_builderbsr2csHeZdZdZdZ<04>fdd<04>Zedd<06><00>Zdd<08>Zd d
<EFBFBD>Z d d <0C>Z
<EFBFBD>Z S) <0A> FlaskClientaDWorks 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.
Fcs(tt|<00>j||<02>ddtjd<03>|_dS)Nz 127.0.0.1z werkzeug/)Z REMOTE_ADDRZHTTP_USER_AGENT)rr3r<00>werkzeug<75> __version__<5F> environ_base)rr r!)r$r%r&r<00>szFlaskClient.__init__c os<>|jdkrtd<02><01>|j}|<02>di<00>}|j<00>|<04>tj}|j||<02><01><>}|j}|<07> ||j
<EFBFBD>}|dkrhtd<04><01>t<05> |<05>z
|VWdt<05> <0C>X|<03> <0A>} |<07>|<08>s<>|<07>||| <09>| <09>|j
j<11>}
|j<00>|j
j|
<EFBFBD>WdQRXdS)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.<2E>environ_overridesz?Session backend did not open a session. Check the configuration)Z
cookie_jar<EFBFBD> RuntimeError<6F> applicationr'Z inject_wsgir<00>topZtest_request_context<78>session_interfaceZ open_session<6F>request<73>push<73>pop<6F>response_classZis_null_sessionZ save_sessionZget_wsgi_headers<72>environZ extract_wsgi) rr r!rr7Z outer_reqctx<74>cr;<00>sess<73>resp<73>headersr%r%r&<00>session_transaction<6F>s,
  



zFlaskClient.session_transactioncOs<>|<02>dd<02>}|<02>dd<02>}|<02>dd<02>}|s<>t|<01>dkr<>t|dtjjtf<02>r<>|j<07><08>}t|dtjj<05>rz|<06> |d<00>
<EFBFBD><00>n|<06> |d<00>|j |d<nJ|j |<02> di<00>d<|<02> d |j<07>t|j f|<01>|<02>}z |<07>
<EFBFBD>}Wd|<07><0E>Xtj|||||d
<EFBFBD>S) N<>as_tupleF<65>buffered<65>follow_redirectsrrzflask._preserve_contextr7r6)rFrGrH)r><00>lenrr4<00>testr
<00>dictr6<00>copy<70>updateZ get_environ<6F>preserve_contextr'r9<00>closer<00>open)rr r!rFrGrHr@<00>builderr%r%r&rP<00>s.    
  
zFlaskClient.opencCs|jrtd<01><01>d|_|S)NzCannot nest client invocationsT)rNr8)rr%r%r&<00> __enter__<5F>szFlaskClient.__enter__cCs0d|_x$tj}|dk r&|jr&|<04><04>qPqWdS)NF)rNrr:Z preservedr>)r<00>exc_type<70> exc_value<75>tbr:r%r%r&<00>__exit__<5F>s 
zFlaskClient.__exit__) r*r+r,r-rNrrrErPrRrVr.r%r%)r$r&r3ss   5&r3cs.eZdZdZ<03>fdd<03>Zd<07>fdd<06> Z<05>ZS)<08>FlaskCliRunnerz<72>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`.
c s||_tt|<00>jf|<02>dS)N)rrrWr)rrr!)r$r%r&rszFlaskCliRunner.__init__Nc sD|dkr<10>jj}d|kr.t<02>fdd<04>d<05>|d<tt<04><00>j||f|<03>S)acInvokes 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.
Nr)cs<00>jS)N)rr%)rr%r&<00><lambda><00>z'FlaskCliRunner.invoke.<locals>.<lambda>)Z
create_app)r<00>clirrrW<00>invoke)rrZr r!)r$)rr&r[s
zFlaskCliRunner.invoke)NN)r*r+r,r-rr[r.r%r%)r$r&rW<00>s rW)r-r/<00>
contextlibrZ werkzeug.testr4Z click.testingrrZ werkzeug.urlsr<00>rrZr<00>jsonr r(rJr
r2r3rWr%r%r%r&<00><module> s       I