1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
======================================
Functional Testing of Web Applications
======================================
.. toctree::
testapp
testresponse
debugapp
Framework Hooks
===============
Frameworks can detect that they are in a testing environment by the
presence (and truth) of the WSGI environmental variable
``"paste.testing"`` (the key name is inherited from
``paste.fixture``).
More generally, frameworks can detect that something (possibly a test
fixture) is ready to catch unexpected errors by the presence and truth
of ``"paste.throw_errors"`` (this is sometimes set outside of testing
fixtures too, when an error-handling middleware is in place).
Frameworks that want to expose the inner structure of the request may
use ``"paste.testing_variables"``. This will be a dictionary -- any
values put into that dictionary will become attributes of the response
object. So if you do ``env["paste.testing_variables"]['template'] =
template_name`` in your framework, then ``response.template`` will be
``template_name``.
|