summaryrefslogtreecommitdiff
path: root/tests/modeltests/test_client/models.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-10-09 04:50:47 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-10-09 04:50:47 +0000
commitb7a73cf9296a2629a45d4b303c2b9207d3c71c40 (patch)
treef2d6d74b946695c98a5f078146a4711ef2e301dc /tests/modeltests/test_client/models.py
parent816c7d1e644f72563ee4a86582bb98ea3b1922e4 (diff)
Fixed #14378 -- Made the test client class customizable. Thanks to Ned Batchelder for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14058 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/test_client/models.py')
-rw-r--r--tests/modeltests/test_client/models.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/modeltests/test_client/models.py b/tests/modeltests/test_client/models.py
index 30520082da..cd3269ee26 100644
--- a/tests/modeltests/test_client/models.py
+++ b/tests/modeltests/test_client/models.py
@@ -457,3 +457,15 @@ class CSRFEnabledClientTests(TestCase):
# The CSRF-enabled client rejects it
response = csrf_client.post('/test_client/post_view/', {})
self.assertEqual(response.status_code, 403)
+
+
+class CustomTestClient(Client):
+ i_am_customized = "Yes"
+
+class CustomTestClientTest(TestCase):
+ client_class = CustomTestClient
+
+ def test_custom_test_client(self):
+ """A test case can specify a custom class for self.client."""
+ self.assertEqual(hasattr(self.client, "i_am_customized"), True)
+