Esempio n. 1
0
 def test_process_limit_lower_than_zero(self):
     with pytest.raises(ValueError) as ex:
         utils.process_limit(1, None, -3)
     assert 'can not be < 0' in str(ex.value)
     with pytest.raises(ValueError) as ex:
         utils.process_limit(-1, None, 3)
     assert 'can not be < 0' in str(ex.value)
Esempio n. 2
0
 def test_process_limit_lower_than_zero(self):
     with pytest.raises(ValueError) as ex:
         utils.process_limit(1, None, -3)
     assert 'can not be < 0' in str(ex.value)
     with pytest.raises(ValueError) as ex:
         utils.process_limit(-1, None, 3)
     assert 'can not be < 0' in str(ex.value)
Esempio n. 3
0
 def test_process_limit_no_start_page(self):
     start, limit = utils.process_limit(start=None, page=None, limit=5)
     assert start == 0
     assert limit == 5
Esempio n. 4
0
 def test_process_limit_start(self):
     start, limit = utils.process_limit(start=1, page=None, limit=5)
     assert start == 1
     assert limit == 5
Esempio n. 5
0
 def test_process_limit_start_and_page(self):
     with pytest.raises(ValueError) as ex:
         utils.process_limit(1, 2, 3)
     assert 'at the same time' in str(ex.value)
Esempio n. 6
0
 def test_process_limit_no_start_page(self):
     start, limit = utils.process_limit(start=None, page=None, limit=5)
     assert start == 0
     assert limit == 5
Esempio n. 7
0
 def test_process_limit_start(self):
     start, limit = utils.process_limit(start=1, page=None, limit=5)
     assert start == 1
     assert limit == 5
Esempio n. 8
0
 def test_process_limit_start_and_page(self):
     with pytest.raises(ValueError) as ex:
         utils.process_limit(1, 2, 3)
     assert 'at the same time' in str(ex.value)