def test_limit_iterator(self):
     """ Test setting the limit on the iterator. """
     
     result_fetcher = functools.partial(self.protocol.get, '/athlete/activities')
     results = BatchedResultsIterator(entity=model.Activity, result_fetcher=result_fetcher, limit=10, per_page=2)
     results.limit = 10
     results = list(results)
     self.assertEquals(10, len(results))
Esempio n. 2
0
 def test_multiple_iterator_calls(self):
     """ Test multiple calls of the iterator. """
     
     result_fetcher = functools.partial(self.protocol.get, '/athlete/activities')
     results = BatchedResultsIterator(entity=model.Activity, result_fetcher=result_fetcher, limit=10, per_page=2)
     results.limit = 10
     results1 = list(results)
     results2 = list(results)
     
     self.assertEquals(10, len(results1))
     self.assertEquals(len(results1), len(results2))
Esempio n. 3
0
    def test_limit_iterator(self):
        """ Test setting the limit on the iterator. """

        result_fetcher = functools.partial(self.protocol.get,
                                           '/athlete/activities')
        results = BatchedResultsIterator(entity=model.Activity,
                                         result_fetcher=result_fetcher,
                                         limit=10,
                                         per_page=2)
        results.limit = 10
        results = list(results)
        self.assertEqual(10, len(results))
Esempio n. 4
0
    def test_multiple_iterator_calls(self):
        """ Test multiple calls of the iterator. """

        result_fetcher = functools.partial(self.protocol.get,
                                           '/athlete/activities')
        results = BatchedResultsIterator(entity=model.Activity,
                                         result_fetcher=result_fetcher,
                                         limit=10,
                                         per_page=2)
        results.limit = 10
        results1 = list(results)
        results2 = list(results)

        self.assertEqual(10, len(results1))
        self.assertEqual(len(results1), len(results2))