Renaming DRFRequestFactory to RequestFactory

Updated tests to reflect the new name.
This commit is contained in:
Andrew Hankinson 2012-12-30 13:57:43 -04:00
parent b9e48e8413
commit df1880185c
3 changed files with 7 additions and 8 deletions

View File

@ -1,7 +1,6 @@
from django.test import TestCase from django.test import TestCase
from rest_framework import status from rest_framework import status
from rest_framework.response import Response from rest_framework.response import Response
# from django.test.client import RequestFactory
from rest_framework.renderers import JSONRenderer from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser from rest_framework.parsers import JSONParser
from rest_framework.authentication import BasicAuthentication from rest_framework.authentication import BasicAuthentication
@ -17,13 +16,13 @@ from rest_framework.decorators import (
permission_classes, permission_classes,
) )
from rest_framework.tests.utils import DRFRequestFactory from rest_framework.tests.utils import RequestFactory
class DecoratorTestCase(TestCase): class DecoratorTestCase(TestCase):
def setUp(self): def setUp(self):
self.factory = DRFRequestFactory() self.factory = RequestFactory()
def _finalize_response(self, request, response, *args, **kwargs): def _finalize_response(self, request, response, *args, **kwargs):
response.request = request response.request = request

View File

@ -1,11 +1,11 @@
from django.test import TestCase from django.test import TestCase
from django.utils import simplejson as json from django.utils import simplejson as json
from rest_framework import generics, serializers, status from rest_framework import generics, serializers, status
from rest_framework.tests.utils import DRFRequestFactory from rest_framework.tests.utils import RequestFactory
from rest_framework.tests.models import BasicModel, Comment, SlugBasedModel from rest_framework.tests.models import BasicModel, Comment, SlugBasedModel
factory = DRFRequestFactory() factory = RequestFactory()
class RootView(generics.ListCreateAPIView): class RootView(generics.ListCreateAPIView):
@ -15,7 +15,7 @@ class RootView(generics.ListCreateAPIView):
model = BasicModel model = BasicModel
class InstanceView(generics.RetrievePartialUpdateDestroyAPIView): class InstanceView(generics.RetrieveUpdateDestroyAPIView):
""" """
Example description for OPTIONS. Example description for OPTIONS.
""" """

View File

@ -3,10 +3,10 @@ from django.test.client import MULTIPART_CONTENT
from urlparse import urlparse from urlparse import urlparse
class DRFRequestFactory(RequestFactory): class RequestFactory(RequestFactory):
def __init__(self, **defaults): def __init__(self, **defaults):
super(DRFRequestFactory, self).__init__(**defaults) super(RequestFactory, self).__init__(**defaults)
def patch(self, path, data={}, content_type=MULTIPART_CONTENT, def patch(self, path, data={}, content_type=MULTIPART_CONTENT,
**extra): **extra):