Edited docs/topics/testing.txt change from [14058]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14368 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
19a089ce76
commit
1356947fad
|
@ -1174,22 +1174,21 @@ Customizing the test client
|
||||||
|
|
||||||
.. attribute:: TestCase.client_class
|
.. attribute:: TestCase.client_class
|
||||||
|
|
||||||
If you want to use a different Client class (for example, a subclass
|
If you want to use a different ``Client`` class (for example, a subclass
|
||||||
with customized behavior), you can use the
|
with customized behavior), use the :attr:`~TestCase.client_class` class
|
||||||
:attr:`~TestCase.client_class` class attribute to specify a custom
|
attribute::
|
||||||
``Client`` class in your test case::
|
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
class MyTestClient(Client):
|
class MyTestClient(Client):
|
||||||
# .. specialized methods for your environment ..
|
# Specialized methods for your environment...
|
||||||
|
|
||||||
class MyTest(TestCase):
|
class MyTest(TestCase):
|
||||||
client_class = MyTestClient
|
client_class = MyTestClient
|
||||||
|
|
||||||
def test_my_stuff(self):
|
def test_my_stuff(self):
|
||||||
# .. Here self.client is an instance of MyTestClient ..
|
# Here self.client is an instance of MyTestClient...
|
||||||
|
|
||||||
.. _topics-testing-fixtures:
|
.. _topics-testing-fixtures:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue