title: Django rest framework unit test viewsets mixins
body: <p>I need to unit test a Django REST framework mixin. so i go for a test that looks like this:</p>
  
  <pre><code>class TestMyMixin(APITestCase):
  
      class DummyView(MyMixin,
          viewsets.ModelViewSet):
          queryset = MyModel.objects.all()
          serializer_class = MyModelSerializer
  
          #some properties omitted
  
      def setUp(self):
          self.view = self.DummyView.as_view(\
              actions={'get':'list'})
  
      def test_basic_query(self):
          instance = MyModel.objects.create(\
              **{'name':'alex'})
          request = APIRequestFactory().get(\
              '/fake-path?query=ale',
              content_type='application/json')
          response = self.view(request)
          self.assertEqual(\
              response.status_code,status.HTTP_200_OK)
          json_dict = json.loads(\
              response.content.decode('utf-8'))
          self.assertEqual(json_dict['name'],instance.name)
  </code></pre>
  
  <p>However when i run this test i do get the:</p>
  
  <pre><code>raise ContentNotRenderedError('The response content must be 'django.template.response.ContentNotRenderedError: The response content must be rendered before it can be accessed.
  </code></pre>
  
  <p>It seems that django REST framework would have some different approach to unit test <code>viewsets</code>, <code>mixins</code> and <code>views</code>.<br>
  But I can not figure out what should I do instead. <br>
  The official docs page suggests to use real urls, but it suits more for acceptance tests rather than for unit tests.</p>