Merge branch 'topic/CustomPerPageWithoutUrlParam' into develop

This commit is contained in:
Vincent Jacques
2013-06-19 12:39:56 +02:00
3 changed files with 63 additions and 2 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ class PaginatedList(PaginatedListBase):
self.__firstUrl = firstUrl
self.__firstParams = firstParams or ()
self.__nextUrl = firstUrl
self.__nextParams = firstParams
self.__nextParams = firstParams or {}
if self.__requester.per_page != 30:
self.__nextParams["per_page"] = self.__requester.per_page
+18 -1
View File
@@ -15,7 +15,8 @@
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
import Framework
import CommitComment
from github.PaginatedList import PaginatedList as PaginatedListImpl
class PaginatedList(Framework.TestCase):
def setUp(self):
@@ -88,6 +89,22 @@ class PaginatedList(Framework.TestCase):
self.g.per_page = 100
self.assertEqual(self.g.per_page, 100)
self.assertEqual(len(list(self.repo.get_issues())), 456)
def testCustomPerPageWithNoUrlParams(self):
self.g.per_page = 100
paginated_list = PaginatedListImpl(
CommitComment.CommitComment,
self.repo._requester,
self.repo.url + "/comments",
None
)
def testCustomPerPageWithNoUrlParams2(self):
# This test is redountant and less unitary than testCustomPerPageWithNoUrlParams
# but I hope it will be more robust if we refactor PaginatedList,
# because testCustomPerPageWithNoUrlParams only tests the constructor
self.g.per_page = 100
self.assertEqual(len(list(self.repo.get_comments())), 325)
def testCustomPerPageWithGetPage(self):
self.g.per_page = 100
File diff suppressed because one or more lines are too long