Exemple #1
0
 def test_page_number_no_page(self, request):
     """
     Test :py:meth:`.MultipleObjectMixin.get_page_number` without given page
     """
     request.args = {}
     mixin = MultipleObjectMixin()
     mixin.kwargs = {}
     self.assertEqual(1, mixin.get_page_number())
Exemple #2
0
 def test_page_number_no_page(self, request):
     """
     Test :py:meth:`.MultipleObjectMixin.get_page_number` without given page
     """
     request.args = {}
     mixin = MultipleObjectMixin()
     mixin.kwargs = {}
     self.assertEqual(1, mixin.get_page_number())
Exemple #3
0
    def test_page_number_kwargs(self):
        """
        Test :py:meth:`.MultipleObjectMixin.get_page_number`.

        This tests retrieving the page number from the URL route arguments.

        """
        mixin = MultipleObjectMixin()
        mixin.kwargs = {
            'page': 10,
        }
        self.assertEqual(10, mixin.get_page_number())
Exemple #4
0
    def test_page_number_kwargs(self):
        """
        Test :py:meth:`.MultipleObjectMixin.get_page_number`.

        This tests retrieving the page number from the URL route arguments.

        """
        mixin = MultipleObjectMixin()
        mixin.kwargs = {
            'page': 10,
        }
        self.assertEqual(10, mixin.get_page_number())
Exemple #5
0
    def test_page_number_request_args(self, request):
        """
        Test :py:meth:`.MultipleObjectMixin.get_page_number`.

        This tests retrieving the page number from the request arguments.

        """
        request.args = {
            'page': '10',
        }
        mixin = MultipleObjectMixin()
        mixin.kwargs = {}
        self.assertEqual(10, mixin.get_page_number())
Exemple #6
0
    def test_page_number_request_args(self, request):
        """
        Test :py:meth:`.MultipleObjectMixin.get_page_number`.

        This tests retrieving the page number from the request arguments.

        """
        request.args = {
            'page': '10',
        }
        mixin = MultipleObjectMixin()
        mixin.kwargs = {}
        self.assertEqual(10, mixin.get_page_number())
Exemple #7
0
 def test_get_filter_fields(self):
     """
     Test :py:meth:`.MultipleObjectMixin.get_filter_fields`.
     """
     mixin = MultipleObjectMixin()
     mixin.kwargs = {
         'category': 'foo',
         'username': '******',
     }
     mixin.filter_fields = {
         'cat': 'category',
         'user': '******',
     }
     self.assertEqual({
         'cat': 'foo',
         'user': '******',
     }, mixin.get_filter_fields())
Exemple #8
0
 def test_get_filter_fields(self):
     """
     Test :py:meth:`.MultipleObjectMixin.get_filter_fields`.
     """
     mixin = MultipleObjectMixin()
     mixin.kwargs = {
         'category': 'foo',
         'username': '******',
     }
     mixin.filter_fields = {
         'cat': 'category',
         'user': '******',
     }
     self.assertEqual({
         'cat': 'foo',
         'user': '******',
     }, mixin.get_filter_fields())