OpenQuizz
Une application de gestion des contenus pédagogiques
werkzeug.test Namespace Reference

Data Structures

class  _TestCookieHeaders
 
class  _TestCookieJar
 
class  _TestCookieResponse
 
class  Client
 
class  ClientRedirectError
 
class  EnvironBuilder
 

Functions

def stream_encode_multipart (values, use_tempfile=True, threshold=1024 *500, boundary=None, charset="utf-8")
 
def encode_multipart (values, boundary=None, charset="utf-8")
 
def create_environ (*args, **kwargs)
 
def run_wsgi_app (app, environ, buffered=False)
 

Function Documentation

◆ create_environ()

def werkzeug.test.create_environ ( args,
**  kwargs 
)
Create a new WSGI environ dict based on the values passed.  The first
parameter should be the path of the request which defaults to '/'.  The
second one can either be an absolute path (in that case the host is
localhost:80) or a full path to the request with scheme, netloc port and
the path to the script.

This accepts the same arguments as the :class:`EnvironBuilder`
constructor.

.. versionchanged:: 0.5
   This function is now a thin wrapper over :class:`EnvironBuilder` which
   was added in 0.5.  The `headers`, `environ_base`, `environ_overrides`
   and `charset` parameters were added.

◆ encode_multipart()

def werkzeug.test.encode_multipart (   values,
  boundary = None,
  charset = "utf-8" 
)
Like `stream_encode_multipart` but returns a tuple in the form
(``boundary``, ``data``) where data is a bytestring.

◆ run_wsgi_app()

def werkzeug.test.run_wsgi_app (   app,
  environ,
  buffered = False 
)
Return a tuple in the form (app_iter, status, headers) of the
application output.  This works best if you pass it an application that
returns an iterator all the time.

Sometimes applications may use the `write()` callable returned
by the `start_response` function.  This tries to resolve such edge
cases automatically.  But if you don't get the expected output you
should set `buffered` to `True` which enforces buffering.

If passed an invalid WSGI application the behavior of this function is
undefined.  Never pass non-conforming WSGI applications to this function.

:param app: the application to execute.
:param buffered: set to `True` to enforce buffering.
:return: tuple in the form ``(app_iter, status, headers)``

◆ stream_encode_multipart()

def werkzeug.test.stream_encode_multipart (   values,
  use_tempfile = True,
  threshold = 1024 * 500,
  boundary = None,
  charset = "utf-8" 
)
Encode a dict of values (either strings or file descriptors or
:class:`FileStorage` objects.) into a multipart encoded string stored
in a file descriptor.