Exemplo n.º 1
0
 def test_valid_limit_and_page_size(self):
     # Test valid limit and page_size parameters.
     req = webob.Request.blank('/?limit=20&page_size=5')
     self.assertEqual(common.get_pagination_params(req), {
         'page_size': 5,
         'limit': 20
     })
Exemplo n.º 2
0
 def test_valid_limit_and_marker(self):
     # Test valid limit and marker parameters.
     marker = '263abb28-1de6-412f-b00b-f0ee0c4333c2'
     req = webob.Request.blank('/?limit=20&marker=%s' % marker)
     self.assertEqual(common.get_pagination_params(req), {
         'marker': marker,
         'limit': 20
     })
Exemplo n.º 3
0
 def test_valid_page_size(self):
     # Test valid page_size param.
     req = webob.Request.blank('/?page_size=10')
     self.assertEqual(common.get_pagination_params(req), {'page_size': 10})
Exemplo n.º 4
0
 def test_valid_marker(self):
     # Test valid marker param.
     req = webob.Request.blank('/?marker=263abb28-1de6-412f-b00'
                               'b-f0ee0c4333c2')
     self.assertEqual(common.get_pagination_params(req),
                      {'marker': '263abb28-1de6-412f-b00b-f0ee0c4333c2'})
Exemplo n.º 5
0
 def test_valid_limit(self):
     # Test valid limit param.
     req = webob.Request.blank('/?limit=10')
     self.assertEqual(common.get_pagination_params(req), {'limit': 10})
Exemplo n.º 6
0
 def test_valid_limit_and_page_size(self):
     # Test valid limit and page_size parameters.
     req = webob.Request.blank('/?limit=20&page_size=5')
     self.assertEqual(common.get_pagination_params(req),
                      {'page_size': 5, 'limit': 20})
Exemplo n.º 7
0
 def test_no_params(self):
     # Test no params.
     req = webob.Request.blank('/')
     self.assertEqual(common.get_pagination_params(req), {})
Exemplo n.º 8
0
 def test_valid_page_size(self):
     # Test valid page_size param.
     req = webob.Request.blank('/?page_size=10')
     self.assertEqual(common.get_pagination_params(req),
                      {'page_size': 10})
Exemplo n.º 9
0
 def test_valid_limit_and_marker(self):
     # Test valid limit and marker parameters.
     marker = '263abb28-1de6-412f-b00b-f0ee0c4333c2'
     req = webob.Request.blank('/?limit=20&marker=%s' % marker)
     self.assertEqual(common.get_pagination_params(req),
                      {'marker': marker, 'limit': 20})
Exemplo n.º 10
0
 def test_valid_limit(self):
     # Test valid limit param.
     req = webob.Request.blank('/?limit=10')
     self.assertEqual(common.get_pagination_params(req), {'limit': 10})
Exemplo n.º 11
0
 def test_valid_marker(self):
     # Test valid marker param.
     req = webob.Request.blank('/?marker=263abb28-1de6-412f-b00'
                               'b-f0ee0c4333c2')
     self.assertEqual(common.get_pagination_params(req),
                      {'marker': '263abb28-1de6-412f-b00b-f0ee0c4333c2'})
Exemplo n.º 12
0
 def test_no_params(self):
     # Test no params.
     req = webob.Request.blank('/')
     self.assertEqual(common.get_pagination_params(req), {})