  
  
  class RequestTestCase(TestCase):
  
      def tearDown(self):
          request_class.parsers = ()
  
      def build_request(self, method, *args, **kwargs):
          factory = RequestFactory()
          method = getattr(factory, method)
          original_request = method(*args, **kwargs)
          return request_class(original_request)
 
</s> remove     def tearDown(self):
        request_class.parsers = ()

 </s> add  </s> remove         return request_class(original_request)
 </s> add         return Request(original_request) </s> remove         return request_class(original_request)
 </s> add         rkwargs = {}
        if parsers is not None:
            rkwargs['parsers'] = parsers
        request = Request(original_request, **rkwargs)
        # TODO: Just a hack because the parsers need a view. This will be fixed in the future
        class Obj(object): pass
        obj = Obj()
        obj.request = request
        for p in request.parsers:
            p.view = obj
        return request </s> remove from djangorestframework.request import request_class_factory

class MockView(View):
    authentication = (UserLoggedInAuthentication,)
    def post(self, request):
        if request.POST.get('example') is not None:
            return Response(status=status.HTTP_200_OK)

        return Response(status=status.INTERNAL_SERVER_ERROR)

urlpatterns = patterns('',
    (r'^$', MockView.as_view()),
)

request_class = request_class_factory(RequestFactory().get('/'))
 </s> add 
  
  
  class RequestTestCase(TestCase):
  



      def build_request(self, method, *args, **kwargs):
          factory = RequestFactory()
          method = getattr(factory, method)
          original_request = method(*args, **kwargs)
          return request_class(original_request)
keep keep keep keep replace replace replace keep keep keep keep keep
 cleaned Request/Response/mixins to have similar interface 
djangorestframework/tests/request.py