Django

Code

Changeset 3715

Show
Ignore:
Timestamp:
09/04/06 09:22:30 (2 years ago)
Author:
russellm
Message:

Refs #2333 - Made minor formatting modifications to test framework documentation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/testing.txt

    r3713 r3715  
    268268for testing purposes: 
    269269 
    270 ``status_code`` 
    271  
    272     The HTTP status of the response. See RFC2616_ for a full list of HTTP status  
    273     codes. 
    274  
    275     .. _RFC2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 
    276  
    277 ``content`` 
    278  
    279     The body of the response. The is the final page content as rendered by  
    280     the view, or any error message (such as the URL for a 302 redirect). 
    281  
    282 ``template`` 
    283  
    284     The Template instance that was used to render the final content.  
    285     Testing ``template.name`` can be particularly useful; if the  
    286     template was loaded from a file, ``name`` will be the file name that  
    287     was loaded.  
    288  
    289     If multiple templates were rendered, (e.g., if one template includes  
    290     another template),``template`` will be a list of Template objects, in  
    291     the order in which they were rendered. 
    292  
    293 ``context`` 
    294  
    295     The Context that was used to render the template that produced the  
    296     response content. 
    297  
    298     As with ``template``, if multiple templates were rendered ``context``  
    299     will be a list of Context objects, stored in the order in which they  
    300     were rendered.  
     270    ===============  ========================================================== 
     271    Property         Description 
     272    ===============  ========================================================== 
     273    ``status_code``  The HTTP status of the response. See RFC2616_ for a  
     274                     full list of HTTP status codes. 
     275 
     276    ``content``      The body of the response. The is the final page  
     277                     content as rendered by the view, or any error message  
     278                     (such as the URL for a 302 redirect). 
     279 
     280    ``template``     The Template instance that was used to render the final  
     281                     content. Testing ``template.name`` can be particularly  
     282                     useful; if the template was loaded from a file,  
     283                     ``template.name`` will be the file name that was loaded.  
     284 
     285                     If multiple templates were rendered, (e.g., if one  
     286                     template includes another template),``template`` will  
     287                     be a list of Template objects, in the order in which  
     288                     they were rendered. 
     289 
     290    ``context``      The Context that was used to render the template that  
     291                     produced the response content. 
     292 
     293                     As with ``template``, if multiple templates were rendered  
     294                     ``context`` will be a list of Context objects, stored in  
     295                     the order in which they were rendered.  
     296    ===============  ========================================================== 
     297 
     298.. _RFC2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 
    301299 
    302300The following is a simple unit test using the Test Client:: 
     
    412410 
    413411``run_tests(module_list, verbosity=1)`` 
    414  
    415412    The module list is the list of Python modules that contain the models to be 
    416413    tested. This is the same format returned by ``django.db.models.get_apps()`` 
     
    431428 
    432429``teardown_test_environment()`` 
    433  
    434430    Performs any global post-test teardown, such as removing the instrumentation  
    435431    of the template rendering system.