Exemplo n.º 1
0
def get_paginator(request, count):
    """Get Paginator."""
    paginator = StandardResultsSetPagination()
    paginator.count = count
    paginator.request = request
    paginator.limit = _get_int_query_param(request, "limit", 10)
    paginator.offset = _get_int_query_param(request, "offset", 0)
    return paginator
Exemplo n.º 2
0
 def test_get_previous_link_value(self, mock_super):
     """Test the get previous link method when super returns a value."""
     expected = 'http://localhost:8000/api/v1/providers/?offset=20'
     mock_super.return_value = expected
     paginator = StandardResultsSetPagination()
     paginator.request = Mock
     paginator.request.META = {}
     link = paginator.get_previous_link()
     self.assertEqual(link, expected)