class TestPagination(unittest.TestCase): def setUp(self): self.model = BaseModel() self.model.page_size = 10 self.collection = self.model.mongo.get_collection('logs') self.collection.remove() def test_one_page(self): for i in range(0,10): dict = {'id': i} self.collection.insert(dict) result = self.collection.find() paginate = self.model.paginate(result) eq_(paginate['pages'], 1) eq_(paginate['result'].count(), 10) self.collection.remove() def test_multiple_pages(self): for i in range(0, 50): dict = {'id': i} self.collection.insert(dict) result = self.collection.find() paginate = self.model.paginate(result) eq_(paginate['pages'], 5) # Count ignores limit and skip by default, overwriting the default with 'True' eq_(paginate['result'].count('True'), 10) self.collection.remove()
class TestPagination(unittest.TestCase): def setUp(self): self.model = BaseModel() self.model.page_size = 10 self.collection = self.model.mongo.get_collection('logs') self.collection.remove() def test_one_page(self): for i in range(0, 10): dict = {'id': i} self.collection.insert(dict) result = self.collection.find() paginate = self.model.paginate(result) eq_(paginate['pages'], 1) eq_(paginate['result'].count(), 10) self.collection.remove() def test_multiple_pages(self): for i in range(0, 50): dict = {'id': i} self.collection.insert(dict) result = self.collection.find() paginate = self.model.paginate(result) eq_(paginate['pages'], 5) # Count ignores limit and skip by default, overwriting the default with 'True' eq_(paginate['result'].count('True'), 10) self.collection.remove()
def setUp(self): self.model = BaseModel() self.model.page_size = 10 self.collection = self.model.mongo.get_collection("logs") self.collection.remove()
def setUp(self): self.model = BaseModel() self.model.page_size = 10 self.collection = self.model.mongo.get_collection('logs') self.collection.remove()