Add support to create Repository objects lazily in MainClass.

This lets users do the following without issuing an unnecessary request:

issues_of_my_repository = g.get_repo('PyGithub/PyGithub').get_issues()

Since the GithubObject layer handles laziness transparently, lazy
loading is enabled by default, and can be disabled via the `lazy`
kwarg. This does not affect any test except tests that pertain to
caching or laziness itself.
This commit is contained in:
Uriel Corfa
2015-03-26 20:56:27 -07:00
parent ca13204dd5
commit 626d29c938
8 changed files with 111 additions and 15 deletions
+3 -3
View File
@@ -31,14 +31,14 @@ import github
class ConditionalRequestUpdate(Framework.TestCase):
def setUp(self):
Framework.TestCase.setUp(self)
self.repo = self.g.get_repo("akfish/PyGithub")
self.repo = self.g.get_repo("akfish/PyGithub", lazy=False)
def testDidNotUpdate(self):
self.assertFalse(self.repo.update(), msg="The repo is not changes. But update() != False")
self.assertFalse(self.repo.update(), msg="The repo is not changed. But update() != False")
def testDidUpdate(self):
self.assertTrue(self.repo.update(), msg="The repo should be changed by now. But update() != True")
def testUpdateObjectWithoutEtag(self):
r = self.g.get_repo("jacquev6/PyGithub")
r = self.g.get_repo("jacquev6/PyGithub", lazy=False)
self.assertTrue(r.update())