mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Renaming DRFRequestFactory to RequestFactory
Updated tests to reflect the new name.
This commit is contained in:
parent
b9e48e8413
commit
df1880185c
|
@ -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
|
||||||
|
|
|
@ -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.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user