コード例 #1
0
ファイル: test_templatetags.py プロジェクト: whalerock/ella
 def test_always_include_given_number_of_pages(self):
     page = Paginator(range(100), 9).page(1)
     tools.assert_equals((('inclusion_tags/paginator_special.html', 'inc/paginator_special.html'), {
         'page': page,
         'page_numbers': [1, 2, 3, 4, 5, 6, 7],
         'query_params': '?p=',
         'results_per_page': 9,
         'show_first': False,
         'show_last': True
     }), _do_paginator({'page': page}, 3, 'special'))
コード例 #2
0
 def test_always_include_given_number_of_pages(self):
     page = Paginator(range(100), 9).page(1)
     tools.assert_equals((('inclusion_tags/paginator_special.html',
                           'inc/paginator_special.html'), {
                               'page': page,
                               'page_numbers': [1, 2, 3, 4, 5, 6, 7],
                               'query_params': '?p=',
                               'results_per_page': 9,
                               'show_first': False,
                               'show_last': True
                           }), _do_paginator({'page': page}, 3, 'special'))
コード例 #3
0
ファイル: test_templatetags.py プロジェクト: MikeLing/ella
    def test_all_querysting_is_included(self):
        req = self.rf.get('/', {'using': 'custom_lh', 'other': 'param with spaces'})
        page = Paginator(range(100), 10).page(2)

        context = {
            'request': req,
            'page': page
        }

        tools.assert_equals((('inclusion_tags/paginator.html', 'inc/paginator.html'), {
            'page': page,
            'page_numbers': [1, 2, 3, 4, 5],
            'query_params': '?using=custom_lh&other=param+with+spaces&p=',
            'results_per_page': 10,
            'show_first': False,
            'show_last': True
        }), _do_paginator(context, 2, None))
コード例 #4
0
    def test_all_querysting_is_included(self):
        req = self.rf.get('/', {
            'using': 'custom_lh',
            'other': 'param with spaces'
        })
        page = Paginator(range(100), 10).page(2)

        context = {'request': req, 'page': page}

        tools.assert_equals(
            (('inclusion_tags/paginator.html', 'inc/paginator.html'), {
                'page': page,
                'page_numbers': [1, 2, 3, 4, 5],
                'query_params': '?using=custom_lh&other=param+with+spaces&p=',
                'results_per_page': 10,
                'show_first': False,
                'show_last': True
            }), _do_paginator(context, 2, None))
コード例 #5
0
ファイル: test_templatetags.py プロジェクト: whalerock/ella
    def test_all_querysting_is_included(self):
        req = self.rf.get('/', {'using': 'custom_lh', 'other': 'param with spaces'})
        page = Paginator(range(100), 10).page(2)

        context = {
            'request': req,
            'page': page
        }
        paginated = _do_paginator(context, 2, None)
        # remove the first '?' from the qs and parse it to a dict
        paginated[1]['query_params'] = parse_qs(paginated[1]['query_params'][1:])
        tools.assert_equals(
            (
                ('inclusion_tags/paginator.html', 'inc/paginator.html'), {
                    'page': page,
                    'page_numbers': [1, 2, 3, 4, 5],
                    'query_params': parse_qs('using=custom_lh&other=param+with+spaces&p='),
                    'results_per_page': 10,
                    'show_first': False,
                    'show_last': True
                }
            ),
            paginated
        )
コード例 #6
0
ファイル: test_templatetags.py プロジェクト: whalerock/ella
 def test_dont_fail_on_missing_page(self):
     tools.assert_equals((('inclusion_tags/paginator.html', 'inc/paginator.html'), {}), _do_paginator({}, 2, None))
コード例 #7
0
 def test_dont_fail_on_missing_page(self):
     tools.assert_equals(
         (('inclusion_tags/paginator.html', 'inc/paginator.html'), {}),
         _do_paginator({}, 2, None))