diff options
| author | Cezar Pendarovski | 2014-08-25 17:28:22 +0200 |
|---|---|---|
| committer | Cezar Pendarovski | 2014-08-25 17:28:22 +0200 |
| commit | f6cbd88618553c394b5c62761ec1506e903de267 (patch) | |
| tree | 6e557dbb3ccb2ce7f864efe78658ca2a44937282 /rest_framework/test.py | |
| parent | 4d582fd9ffcb6ec28247e95b63134c00cc131780 (diff) | |
| parent | 21a0a826bba3df01e72ea8b0390e05d50cf9a854 (diff) | |
| download | django-rest-framework-f6cbd88618553c394b5c62761ec1506e903de267.tar.bz2 | |
Merge remote-tracking branch 'upstream/master' into fix-1719
Conflicts:
rest_framework/templates/rest_framework/base.html
Diffstat (limited to 'rest_framework/test.py')
| -rw-r--r-- | rest_framework/test.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/rest_framework/test.py b/rest_framework/test.py index 284bcee0..f89a6dcd 100644 --- a/rest_framework/test.py +++ b/rest_framework/test.py @@ -8,10 +8,11 @@ from django.conf import settings from django.test.client import Client as DjangoClient from django.test.client import ClientHandler from django.test import testcases +from django.utils import six from django.utils.http import urlencode from rest_framework.settings import api_settings from rest_framework.compat import RequestFactory as DjangoRequestFactory -from rest_framework.compat import force_bytes_or_smart_bytes, six +from rest_framework.compat import force_bytes_or_smart_bytes def force_authenticate(request, user=None, token=None): @@ -49,9 +50,10 @@ class APIRequestFactory(DjangoRequestFactory): else: format = format or self.default_format - assert format in self.renderer_classes, ("Invalid format '{0}'. " - "Available formats are {1}. Set TEST_REQUEST_RENDERER_CLASSES " - "to enable extra request formats.".format( + assert format in self.renderer_classes, ( + "Invalid format '{0}'. Available formats are {1}. " + "Set TEST_REQUEST_RENDERER_CLASSES to enable " + "extra request formats.".format( format, ', '.join(["'" + fmt + "'" for fmt in self.renderer_classes.keys()]) ) @@ -154,6 +156,10 @@ class APIClient(APIRequestFactory, DjangoClient): kwargs.update(self._credentials) return super(APIClient, self).request(**kwargs) + def logout(self): + self._credentials = {} + return super(APIClient, self).logout() + class APITransactionTestCase(testcases.TransactionTestCase): client_class = APIClient |
