class ViewSetTest(TestCase):

    def test_view_set(self):
        factory = APIRequestFactory()
view = CatViewSet.as_view(actions={'get': 'retrieve'})
cat = Cat(name='bob')
cat.save()
request = factory.get(reverse('cat-detail', args=(cat.pk,)))
response = view(request)
Django Rest Framework - How to test ViewSet?