Commit df188018 by Andrew Hankinson

Renaming DRFRequestFactory to RequestFactory

Updated tests to reflect the new name.
parent b9e48e84
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 ( ...@@ -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
......
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): ...@@ -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.
""" """
......
...@@ -3,10 +3,10 @@ from django.test.client import MULTIPART_CONTENT ...@@ -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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment