Refs #2333 - Made minor tweaks to the formatting of testing documentation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3713 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
8192a808bd
commit
3a919dbe2e
|
@ -209,7 +209,7 @@ Creating an instance of ``Client`` (``django.test.client.Client``) requires
|
||||||
no arguments at time of construction. Once constructed, the following methods
|
no arguments at time of construction. Once constructed, the following methods
|
||||||
can be invoked on the ``Client`` instance.
|
can be invoked on the ``Client`` instance.
|
||||||
|
|
||||||
``get(path, data={}):``
|
``get(path, data={})``
|
||||||
|
|
||||||
Make a GET request on the provided ``path``. The key-value pairs in the
|
Make a GET request on the provided ``path``. The key-value pairs in the
|
||||||
data dictionary will be used to create a GET data payload. For example::
|
data dictionary will be used to create a GET data payload. For example::
|
||||||
|
@ -221,11 +221,11 @@ can be invoked on the ``Client`` instance.
|
||||||
|
|
||||||
http://yoursite.com/customers/details/?name='fred'&age=7
|
http://yoursite.com/customers/details/?name='fred'&age=7
|
||||||
|
|
||||||
``post(path, data={}):``
|
``post(path, data={})``
|
||||||
|
|
||||||
Make a POST request on the provided ``path``. The key-value pairs in the
|
Make a POST request on the provided ``path``. The key-value pairs in the
|
||||||
data dictionary will be used to create the POST data payload. This payload
|
data dictionary will be used to create the POST data payload. This payload
|
||||||
will be transmitted with the mimetype ```multipart/form-data``.
|
will be transmitted with the mimetype ``multipart/form-data``.
|
||||||
|
|
||||||
However submitting files is a special case. To POST a file, you need only
|
However submitting files is a special case. To POST a file, you need only
|
||||||
provide the file field name as a key, and a file handle to the file you wish to
|
provide the file field name as a key, and a file handle to the file you wish to
|
||||||
|
@ -242,7 +242,7 @@ can be invoked on the ``Client`` instance.
|
||||||
file name), and `attachment_file` (containing the file data). Note that you
|
file name), and `attachment_file` (containing the file data). Note that you
|
||||||
need to manually close the file after it has been provided to the POST.
|
need to manually close the file after it has been provided to the POST.
|
||||||
|
|
||||||
``login(path, username, password):``
|
``login(path, username, password)``
|
||||||
|
|
||||||
In a production site, it is likely that some views will be protected with
|
In a production site, it is likely that some views will be protected with
|
||||||
the @login_required URL provided by ``django.contrib.auth``. Interacting
|
the @login_required URL provided by ``django.contrib.auth``. Interacting
|
||||||
|
@ -426,7 +426,6 @@ To assist in the creation of your own test runner, Django provides
|
||||||
a number of utility methods in the ``django.test.utils`` module.
|
a number of utility methods in the ``django.test.utils`` module.
|
||||||
|
|
||||||
``setup_test_environment()``
|
``setup_test_environment()``
|
||||||
|
|
||||||
Performs any global pre-test setup, such as the installing the
|
Performs any global pre-test setup, such as the installing the
|
||||||
instrumentation of the template rendering system.
|
instrumentation of the template rendering system.
|
||||||
|
|
||||||
|
@ -435,8 +434,7 @@ a number of utility methods in the ``django.test.utils`` module.
|
||||||
Performs any global post-test teardown, such as removing the instrumentation
|
Performs any global post-test teardown, such as removing the instrumentation
|
||||||
of the template rendering system.
|
of the template rendering system.
|
||||||
|
|
||||||
``create_test_db(verbosity=1, autoclobber=False)``:
|
``create_test_db(verbosity=1, autoclobber=False)``
|
||||||
|
|
||||||
Creates a new test database, and run ``syncdb`` against it.
|
Creates a new test database, and run ``syncdb`` against it.
|
||||||
|
|
||||||
``verbosity`` has the same behaviour as in the test runner.
|
``verbosity`` has the same behaviour as in the test runner.
|
||||||
|
@ -450,8 +448,7 @@ a number of utility methods in the ``django.test.utils`` module.
|
||||||
``create_test_db()`` has the side effect of modifying
|
``create_test_db()`` has the side effect of modifying
|
||||||
``settings.DATABASE_NAME`` to match the name of the test database.
|
``settings.DATABASE_NAME`` to match the name of the test database.
|
||||||
|
|
||||||
``destroy_test_db(old_database_name, verbosity=1)``:
|
``destroy_test_db(old_database_name, verbosity=1)``
|
||||||
|
|
||||||
Destroys the database with the name ``settings.DATABASE_NAME`` matching,
|
Destroys the database with the name ``settings.DATABASE_NAME`` matching,
|
||||||
and restores the value of ``settings.DATABASE_NAME`` to the provided name.
|
and restores the value of ``settings.DATABASE_NAME`` to the provided name.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue