/usr/local/lib64/python3.6/site-packages/flask/__pycache__
Edit: /usr/local/lib64/python3.6/site-packages/flask/__pycache__/testing.cpython-36.pyc (9089B)
3
^TBgX* @ s d dl Zd dlmZ d dlmZ d dlmZ d dlZd dl m
Z
d dlmZ d dlm
Z
d dlmZ d d
lmZ d dlmZ d dlmZ d d
lmZ ejrd dlmZ d dlmZ G dd dejjZG dd deZ G dd de
Z!dS ) N)contextmanager)copy)
TracebackType) CliRunner)Client) url_parse)Request )
ScriptInfo)_request_ctx_stack)dumps)SessionMixin)TestResponse)Flaskc
sb e Zd ZdZddeeje eje eje ejejdd fdd
Zejejedd d
Z Z
S )EnvironBuildera 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`.
/Nr )apppathbase_url subdomain
url_schemeargskwargsreturnc s |p
|p
| s*|d k t |p|ks*td|d kr|jjdp@d}|jd } |r^| d| }|d krp|jd }t|}
|
jp| d|
jp| d| jd }|
j}|
j rt
|
j trd nd
}|||
j 7 }|| _t
j||f|| d S )Nz8Cannot pass "subdomain" or "url_scheme" with "base_url".ZSERVER_NAME localhostZAPPLICATION_ROOT.ZPREFERRED_URL_SCHEMEz://r ??)boolAssertionErrorconfiggetr schemenetloclstripr query
isinstancebytesr super__init__)selfr r r r r r r Z http_hostZapp_rooturlsep) __class__ ./tmp/pip-build-0s3hx122/flask/flask/testing.pyr) - s(
&zEnvironBuilder.__init__)objr r c K s |j d| j t|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* r0 r r. r. r/ r2 U s zEnvironBuilder.json_dumps)r NNN)__name__
__module____qualname____doc__strtOptionalAnyr) r2
__classcell__r. r. )r- r/ r s r c s e Zd ZU dZddZejejdd fddZe ejejej
eddf ddd Zddd
eje
e
ejdd fd
dZd dddZeeeddddZ ZS )FlaskClientaE 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`.
.. 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.
r FN)r r r c s&