from django.core.paginator import Paginator
from django.http import HttpRequest as DjangoHttpRequest
from django.template import Template, Context
-
-try:
- from django.test import SimpleTestCase
-except ImportError: # Django 1.2 compatible
- from django.test import TestCase as SimpleTestCase
-
+from django.test import SimpleTestCase
from fnp_django_pagination.paginator import InfinitePaginator, FinitePaginator
from fnp_django_pagination.templatetags.pagination_tags import paginate
from fnp_django_pagination.middleware import PaginationMiddleware
Test middleware
"""
def test_get_page_in_request(self):
- middleware = PaginationMiddleware()
+ middleware = PaginationMiddleware(lambda: None)
request = DjangoHttpRequest()
middleware.process_request(request)
self.assertEqual(request.page(''), 1)