def test_page_number_pagination(self):

        view = PageNumberPaginationView.as_view()

        request = factory.get('/')

        with self.assertNumQueries(2):
            response = view(request).render()

        # Check first page of results
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(response.data['count'],6)
        self.assertEqual(response.data['previous'],None)
        self.assertEqual(response.data['next'],'http://testserver/?page=2')
        self.assertEqual(len(response.data['results']),5)

        # Check second page of results
        request = factory.get('/',{'page': 2})
        response = view(request).render()

        self.assertEqual(response.status_code,status.HTTP_200_OK)
        self.assertEqual(len(response.data['results']),1)

        # Check change max size 
        request = factory.get('/',{'page_size': 3})
        response = view(request).render()

        self.assertEqual(response.status_code,status.HTTP_200_OK)
        self.assertEqual(len(response.data['results']),3)
When flat is True, PageNumberPagination should work as in
dataset/ETHPy150Open Axiologue/DjangoRestMultipleModels/drf_multiple_model/tests.py/TestMMViews.test_page_number_pagination