From 626d29c938b7a0726ff14352a2ed6849f2a160db Mon Sep 17 00:00:00 2001 From: Uriel Corfa Date: Thu, 26 Mar 2015 20:54:26 -0700 Subject: [PATCH] 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. --- github/MainClass.py | 5 ++- github/tests/ConditionalRequestUpdate.py | 6 ++-- ...utes.testBadTransformedAttributeInList.txt | 11 ------- .../tests/ReplayData/LazyRepository.setUp.txt | 11 +++++++ .../LazyRepository.testGetIssues.txt | 33 +++++++++++++++++++ .../ReplayData/LazyRepository.testGetUser.txt | 11 +++++++ .../ReplayData/LazyRepository.testOwner.txt | 22 +++++++++++++ github/tests/Repository.py | 27 +++++++++++++++ 8 files changed, 111 insertions(+), 15 deletions(-) create mode 100644 github/tests/ReplayData/LazyRepository.setUp.txt create mode 100644 github/tests/ReplayData/LazyRepository.testGetIssues.txt create mode 100644 github/tests/ReplayData/LazyRepository.testGetUser.txt create mode 100644 github/tests/ReplayData/LazyRepository.testOwner.txt diff --git a/github/MainClass.py b/github/MainClass.py index cfce7eac..adc6e711 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -188,13 +188,16 @@ class Github(object): ) return github.Organization.Organization(self.__requester, headers, data, completed=True) - def get_repo(self, full_name_or_id): + def get_repo(self, full_name_or_id, lazy=True): """ :calls: `GET /repos/:owner/:repo `_ or `GET /repositories/:id `_ :rtype: :class:`github.Repository.Repository` """ assert isinstance(full_name_or_id, (str, unicode, int)), full_name_or_id url_base = "/repositories/" if isinstance(full_name_or_id, int) else "/repos/" + url = "%s%s" % (url_base, full_name_or_id) + if lazy: + return Repository.Repository(self.__requester, {}, {"url": url}, completed=False) headers, data = self.__requester.requestJsonAndCheck( "GET", "%s%s" % (url_base, full_name_or_id) diff --git a/github/tests/ConditionalRequestUpdate.py b/github/tests/ConditionalRequestUpdate.py index 2aaf80ad..a6e48262 100644 --- a/github/tests/ConditionalRequestUpdate.py +++ b/github/tests/ConditionalRequestUpdate.py @@ -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()) diff --git a/github/tests/ReplayData/BadAttributes.testBadTransformedAttributeInList.txt b/github/tests/ReplayData/BadAttributes.testBadTransformedAttributeInList.txt index 33678ebc..c05fde46 100644 --- a/github/tests/ReplayData/BadAttributes.testBadTransformedAttributeInList.txt +++ b/github/tests/ReplayData/BadAttributes.testBadTransformedAttributeInList.txt @@ -1,14 +1,3 @@ -https -GET -api.github.com -None -/repos/klmitch/turnstile -{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -null -200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4999'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('x-github-request-id', 'b9d67757-009d-4a30-9854-f41e04681849'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '4587'), ('server', 'GitHub.com'), ('last-modified', 'Wed, 21 Aug 2013 16:04:54 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"aab62d006633c3842d38e20dc732a2c9"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Thu, 12 Sep 2013 09:09:24 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1378980564')] -{"id":3404510,"name":"turnstile","full_name":"klmitch/turnstile","owner":{"login":"klmitch","id":686398,"avatar_url":"https://1.gravatar.com/avatar/3c505225c6f28a7702b318a991141495?d=https%3A%2F%2Fidenticons.github.com%2Ffffa0f2e30bad5753edbb60f250b7cbe.png","gravatar_id":"3c505225c6f28a7702b318a991141495","url":"https://api.github.com/users/klmitch","html_url":"https://github.com/klmitch","followers_url":"https://api.github.com/users/klmitch/followers","following_url":"https://api.github.com/users/klmitch/following{/other_user}","gists_url":"https://api.github.com/users/klmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/klmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmitch/subscriptions","organizations_url":"https://api.github.com/users/klmitch/orgs","repos_url":"https://api.github.com/users/klmitch/repos","events_url":"https://api.github.com/users/klmitch/events{/privacy}","received_events_url":"https://api.github.com/users/klmitch/received_events","type":"User"},"private":false,"html_url":"https://github.com/klmitch/turnstile","description":"A distributed rate limiting WSGI middleware.","fork":false,"url":"https://api.github.com/repos/klmitch/turnstile","forks_url":"https://api.github.com/repos/klmitch/turnstile/forks","keys_url":"https://api.github.com/repos/klmitch/turnstile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/klmitch/turnstile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/klmitch/turnstile/teams","hooks_url":"https://api.github.com/repos/klmitch/turnstile/hooks","issue_events_url":"https://api.github.com/repos/klmitch/turnstile/issues/events{/number}","events_url":"https://api.github.com/repos/klmitch/turnstile/events","assignees_url":"https://api.github.com/repos/klmitch/turnstile/assignees{/user}","branches_url":"https://api.github.com/repos/klmitch/turnstile/branches{/branch}","tags_url":"https://api.github.com/repos/klmitch/turnstile/tags","blobs_url":"https://api.github.com/repos/klmitch/turnstile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/klmitch/turnstile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/klmitch/turnstile/git/refs{/sha}","trees_url":"https://api.github.com/repos/klmitch/turnstile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/klmitch/turnstile/statuses/{sha}","languages_url":"https://api.github.com/repos/klmitch/turnstile/languages","stargazers_url":"https://api.github.com/repos/klmitch/turnstile/stargazers","contributors_url":"https://api.github.com/repos/klmitch/turnstile/contributors","subscribers_url":"https://api.github.com/repos/klmitch/turnstile/subscribers","subscription_url":"https://api.github.com/repos/klmitch/turnstile/subscription","commits_url":"https://api.github.com/repos/klmitch/turnstile/commits{/sha}","git_commits_url":"https://api.github.com/repos/klmitch/turnstile/git/commits{/sha}","comments_url":"https://api.github.com/repos/klmitch/turnstile/comments{/number}","issue_comment_url":"https://api.github.com/repos/klmitch/turnstile/issues/comments/{number}","contents_url":"https://api.github.com/repos/klmitch/turnstile/contents/{+path}","compare_url":"https://api.github.com/repos/klmitch/turnstile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/klmitch/turnstile/merges","archive_url":"https://api.github.com/repos/klmitch/turnstile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/klmitch/turnstile/downloads","issues_url":"https://api.github.com/repos/klmitch/turnstile/issues{/number}","pulls_url":"https://api.github.com/repos/klmitch/turnstile/pulls{/number}","milestones_url":"https://api.github.com/repos/klmitch/turnstile/milestones{/number}","notifications_url":"https://api.github.com/repos/klmitch/turnstile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/klmitch/turnstile/labels{/name}","created_at":"2012-02-10T05:16:36Z","updated_at":"2013-08-21T16:04:54Z","pushed_at":"2013-05-01T22:22:20Z","git_url":"git://github.com/klmitch/turnstile.git","ssh_url":"git@github.com:klmitch/turnstile.git","clone_url":"https://github.com/klmitch/turnstile.git","svn_url":"https://github.com/klmitch/turnstile","homepage":"","size":260,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":6,"mirror_url":null,"open_issues_count":1,"forks":6,"open_issues":1,"watchers":15,"master_branch":"master","default_branch":"master","permissions":{"admin":false,"push":false,"pull":true},"network_count":6} - https GET api.github.com diff --git a/github/tests/ReplayData/LazyRepository.setUp.txt b/github/tests/ReplayData/LazyRepository.setUp.txt new file mode 100644 index 00000000..c895b97a --- /dev/null +++ b/github/tests/ReplayData/LazyRepository.setUp.txt @@ -0,0 +1,11 @@ +https +GET +api.github.com +None +/user +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +null +200 +[('content-length', '1304'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'c6c65e5196703428e7641f7d1e9bc353'), ('x-oauth-scopes', 'gist, repo, user'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', '"975c21d2f55751d13745ffc5fa12b1c2"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4960'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '6CE875F7:1E5F:42689E:5514C7D8'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('last-modified', 'Fri, 27 Mar 2015 02:56:43 GMT'), ('date', 'Fri, 27 Mar 2015 03:00:40 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1427427963')] +{"login":"korfuri","id":1124263,"avatar_url":"https://avatars.githubusercontent.com/u/1124263?v=3","gravatar_id":"","url":"https://api.github.com/users/korfuri","html_url":"https://github.com/korfuri","followers_url":"https://api.github.com/users/korfuri/followers","following_url":"https://api.github.com/users/korfuri/following{/other_user}","gists_url":"https://api.github.com/users/korfuri/gists{/gist_id}","starred_url":"https://api.github.com/users/korfuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/korfuri/subscriptions","organizations_url":"https://api.github.com/users/korfuri/orgs","repos_url":"https://api.github.com/users/korfuri/repos","events_url":"https://api.github.com/users/korfuri/events{/privacy}","received_events_url":"https://api.github.com/users/korfuri/received_events","type":"User","site_admin":false,"name":"Uriel Corfa","company":"","blog":"http://korfuri.fr/","location":"","email":"uriel@corfa.fr","hireable":false,"bio":null,"public_repos":13,"public_gists":0,"followers":29,"following":57,"created_at":"2011-10-13T02:27:26Z","updated_at":"2015-03-27T02:56:43Z","private_gists":0,"total_private_repos":0,"owned_private_repos":0,"disk_usage":444,"collaborators":0,"plan":{"name":"free","space":976562499,"collaborators":0,"private_repos":0}} + diff --git a/github/tests/ReplayData/LazyRepository.testGetIssues.txt b/github/tests/ReplayData/LazyRepository.testGetIssues.txt new file mode 100644 index 00000000..0f7630bf --- /dev/null +++ b/github/tests/ReplayData/LazyRepository.testGetIssues.txt @@ -0,0 +1,33 @@ +https +GET +api.github.com +None +/repos/korfuri/PyGithub +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +null +200 +[('content-length', '13643'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'd594a23ec74671eba905bf91ef329026'), ('x-oauth-scopes', 'gist, repo, user'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', 'repo'), ('etag', '"4a598c12d70d21ed45f8cc87ca10c0ef"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4963'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '6CE875F7:2CC6:6A71E4:5514C7D6'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('last-modified', 'Fri, 27 Mar 2015 02:56:43 GMT'), ('date', 'Fri, 27 Mar 2015 03:00:38 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1427427963')] +{"id":32964720,"name":"PyGithub","full_name":"korfuri/PyGithub","owner":{"login":"korfuri","id":1124263,"avatar_url":"https://avatars.githubusercontent.com/u/1124263?v=3","gravatar_id":"","url":"https://api.github.com/users/korfuri","html_url":"https://github.com/korfuri","followers_url":"https://api.github.com/users/korfuri/followers","following_url":"https://api.github.com/users/korfuri/following{/other_user}","gists_url":"https://api.github.com/users/korfuri/gists{/gist_id}","starred_url":"https://api.github.com/users/korfuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/korfuri/subscriptions","organizations_url":"https://api.github.com/users/korfuri/orgs","repos_url":"https://api.github.com/users/korfuri/repos","events_url":"https://api.github.com/users/korfuri/events{/privacy}","received_events_url":"https://api.github.com/users/korfuri/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/korfuri/PyGithub","description":"Python library implementing the GitHub API v3","fork":true,"url":"https://api.github.com/repos/korfuri/PyGithub","forks_url":"https://api.github.com/repos/korfuri/PyGithub/forks","keys_url":"https://api.github.com/repos/korfuri/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/korfuri/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/korfuri/PyGithub/teams","hooks_url":"https://api.github.com/repos/korfuri/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/korfuri/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/korfuri/PyGithub/events","assignees_url":"https://api.github.com/repos/korfuri/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/korfuri/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/korfuri/PyGithub/tags","blobs_url":"https://api.github.com/repos/korfuri/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/korfuri/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/korfuri/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/korfuri/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/korfuri/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/korfuri/PyGithub/languages","stargazers_url":"https://api.github.com/repos/korfuri/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/korfuri/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/korfuri/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/korfuri/PyGithub/subscription","commits_url":"https://api.github.com/repos/korfuri/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/korfuri/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/korfuri/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/korfuri/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/korfuri/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/korfuri/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/korfuri/PyGithub/merges","archive_url":"https://api.github.com/repos/korfuri/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/korfuri/PyGithub/downloads","issues_url":"https://api.github.com/repos/korfuri/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/korfuri/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/korfuri/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/korfuri/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/korfuri/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/korfuri/PyGithub/releases{/id}","created_at":"2015-03-27T02:56:40Z","updated_at":"2015-03-27T02:56:43Z","pushed_at":"2015-03-18T19:20:30Z","git_url":"git://github.com/korfuri/PyGithub.git","ssh_url":"git@github.com:korfuri/PyGithub.git","clone_url":"https://github.com/korfuri/PyGithub.git","svn_url":"https://github.com/korfuri/PyGithub","homepage":"http://jacquev6.github.io/PyGithub","size":15874,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"parent":{"id":32905113,"name":"PyGithub","full_name":"Jucyio/PyGithub","owner":{"login":"Jucyio","id":11623651,"avatar_url":"https://avatars.githubusercontent.com/u/11623651?v=3","gravatar_id":"","url":"https://api.github.com/users/Jucyio","html_url":"https://github.com/Jucyio","followers_url":"https://api.github.com/users/Jucyio/followers","following_url":"https://api.github.com/users/Jucyio/following{/other_user}","gists_url":"https://api.github.com/users/Jucyio/gists{/gist_id}","starred_url":"https://api.github.com/users/Jucyio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jucyio/subscriptions","organizations_url":"https://api.github.com/users/Jucyio/orgs","repos_url":"https://api.github.com/users/Jucyio/repos","events_url":"https://api.github.com/users/Jucyio/events{/privacy}","received_events_url":"https://api.github.com/users/Jucyio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Jucyio/PyGithub","description":"Python library implementing the GitHub API v3","fork":true,"url":"https://api.github.com/repos/Jucyio/PyGithub","forks_url":"https://api.github.com/repos/Jucyio/PyGithub/forks","keys_url":"https://api.github.com/repos/Jucyio/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jucyio/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jucyio/PyGithub/teams","hooks_url":"https://api.github.com/repos/Jucyio/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/Jucyio/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/Jucyio/PyGithub/events","assignees_url":"https://api.github.com/repos/Jucyio/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/Jucyio/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/Jucyio/PyGithub/tags","blobs_url":"https://api.github.com/repos/Jucyio/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jucyio/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jucyio/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jucyio/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jucyio/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/Jucyio/PyGithub/languages","stargazers_url":"https://api.github.com/repos/Jucyio/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/Jucyio/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/Jucyio/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/Jucyio/PyGithub/subscription","commits_url":"https://api.github.com/repos/Jucyio/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jucyio/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jucyio/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jucyio/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/Jucyio/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/Jucyio/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jucyio/PyGithub/merges","archive_url":"https://api.github.com/repos/Jucyio/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jucyio/PyGithub/downloads","issues_url":"https://api.github.com/repos/Jucyio/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/Jucyio/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/Jucyio/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/Jucyio/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jucyio/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/Jucyio/PyGithub/releases{/id}","created_at":"2015-03-26T03:17:03Z","updated_at":"2015-03-26T03:17:05Z","pushed_at":"2015-03-18T19:20:30Z","git_url":"git://github.com/Jucyio/PyGithub.git","ssh_url":"git@github.com:Jucyio/PyGithub.git","clone_url":"https://github.com/Jucyio/PyGithub.git","svn_url":"https://github.com/Jucyio/PyGithub","homepage":"http://jacquev6.github.io/PyGithub","size":15874,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"},"source":{"id":3544490,"name":"PyGithub","full_name":"PyGithub/PyGithub","owner":{"login":"PyGithub","id":11288996,"avatar_url":"https://avatars.githubusercontent.com/u/11288996?v=3","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PyGithub/PyGithub","description":"Python library implementing the GitHub API v3","fork":false,"url":"https://api.github.com/repos/PyGithub/PyGithub","forks_url":"https://api.github.com/repos/PyGithub/PyGithub/forks","keys_url":"https://api.github.com/repos/PyGithub/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PyGithub/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/teams","hooks_url":"https://api.github.com/repos/PyGithub/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/PyGithub/PyGithub/events","assignees_url":"https://api.github.com/repos/PyGithub/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/PyGithub/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/PyGithub/PyGithub/tags","blobs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PyGithub/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PyGithub/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/PyGithub/PyGithub/languages","stargazers_url":"https://api.github.com/repos/PyGithub/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/PyGithub/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/PyGithub/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/PyGithub/PyGithub/subscription","commits_url":"https://api.github.com/repos/PyGithub/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/PyGithub/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/PyGithub/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PyGithub/PyGithub/merges","archive_url":"https://api.github.com/repos/PyGithub/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PyGithub/PyGithub/downloads","issues_url":"https://api.github.com/repos/PyGithub/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/PyGithub/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/PyGithub/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/PyGithub/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/PyGithub/PyGithub/releases{/id}","created_at":"2012-02-25T12:53:47Z","updated_at":"2015-03-26T14:31:35Z","pushed_at":"2015-03-18T19:20:30Z","git_url":"git://github.com/PyGithub/PyGithub.git","ssh_url":"git@github.com:PyGithub/PyGithub.git","clone_url":"https://github.com/PyGithub/PyGithub.git","svn_url":"https://github.com/PyGithub/PyGithub","homepage":"http://jacquev6.github.io/PyGithub","size":15874,"stargazers_count":559,"watchers_count":559,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":152,"mirror_url":null,"open_issues_count":24,"forks":152,"open_issues":24,"watchers":559,"default_branch":"master"},"network_count":152,"subscribers_count":1} + +https +GET +api.github.com +None +/repos/korfuri/PyGithub/issues +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +null +200 +[('content-length', '2'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '318e55760cf7cdb40e61175a4d36cd32'), ('x-oauth-scopes', 'gist, repo, user'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', '"ce023c8f5eae55b9873e83f4f0d6e9ae"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4962'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '6CE875F7:1E5F:4266C5:5514C7D6'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Fri, 27 Mar 2015 03:00:39 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1427427963')] +[] + +https +GET +api.github.com +None +/repos/korfuri/PyGithub/issues +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +null +200 +[('content-length', '2'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '474556b853193c38f1b14328ce2d1b7d'), ('x-oauth-scopes', 'gist, repo, user'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', '"ce023c8f5eae55b9873e83f4f0d6e9ae"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4961'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '6CE875F7:1E62:50EDBA:5514C7D7'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Fri, 27 Mar 2015 03:00:39 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1427427963')] +[] + diff --git a/github/tests/ReplayData/LazyRepository.testGetUser.txt b/github/tests/ReplayData/LazyRepository.testGetUser.txt new file mode 100644 index 00000000..ffb07ebb --- /dev/null +++ b/github/tests/ReplayData/LazyRepository.testGetUser.txt @@ -0,0 +1,11 @@ +https +GET +api.github.com +None +/user +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +null +200 +[('content-length', '1304'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '07ff1c8a09e44b62e277fae50a1b1dc4'), ('x-oauth-scopes', 'gist, repo, user'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', '"6754cf6361cd6d31646de909f5c90146"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '6CE875F7:1E63:532872:5514C5BC'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('last-modified', 'Fri, 27 Mar 2015 02:25:51 GMT'), ('date', 'Fri, 27 Mar 2015 02:51:40 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1427427963')] +{"login":"korfuri","id":1124263,"avatar_url":"https://avatars.githubusercontent.com/u/1124263?v=3","gravatar_id":"","url":"https://api.github.com/users/korfuri","html_url":"https://github.com/korfuri","followers_url":"https://api.github.com/users/korfuri/followers","following_url":"https://api.github.com/users/korfuri/following{/other_user}","gists_url":"https://api.github.com/users/korfuri/gists{/gist_id}","starred_url":"https://api.github.com/users/korfuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/korfuri/subscriptions","organizations_url":"https://api.github.com/users/korfuri/orgs","repos_url":"https://api.github.com/users/korfuri/repos","events_url":"https://api.github.com/users/korfuri/events{/privacy}","received_events_url":"https://api.github.com/users/korfuri/received_events","type":"User","site_admin":false,"name":"Uriel Corfa","company":"","blog":"http://korfuri.fr/","location":"","email":"uriel@corfa.fr","hireable":false,"bio":null,"public_repos":12,"public_gists":0,"followers":29,"following":57,"created_at":"2011-10-13T02:27:26Z","updated_at":"2015-03-27T02:25:51Z","private_gists":0,"total_private_repos":0,"owned_private_repos":0,"disk_usage":444,"collaborators":0,"plan":{"name":"free","space":976562499,"collaborators":0,"private_repos":0}} + diff --git a/github/tests/ReplayData/LazyRepository.testOwner.txt b/github/tests/ReplayData/LazyRepository.testOwner.txt new file mode 100644 index 00000000..687db643 --- /dev/null +++ b/github/tests/ReplayData/LazyRepository.testOwner.txt @@ -0,0 +1,22 @@ +https +GET +api.github.com +None +/repos/korfuri/PyGithub +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +null +200 +[('content-length', '13643'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'dc1ce2bfb41810a06c705e83b388572d'), ('x-oauth-scopes', 'gist, repo, user'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', 'repo'), ('etag', '"4a598c12d70d21ed45f8cc87ca10c0ef"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4959'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '6CE875F7:1E66:6831F8:5514C7D8'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('last-modified', 'Fri, 27 Mar 2015 02:56:43 GMT'), ('date', 'Fri, 27 Mar 2015 03:00:40 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1427427963')] +{"id":32964720,"name":"PyGithub","full_name":"korfuri/PyGithub","owner":{"login":"korfuri","id":1124263,"avatar_url":"https://avatars.githubusercontent.com/u/1124263?v=3","gravatar_id":"","url":"https://api.github.com/users/korfuri","html_url":"https://github.com/korfuri","followers_url":"https://api.github.com/users/korfuri/followers","following_url":"https://api.github.com/users/korfuri/following{/other_user}","gists_url":"https://api.github.com/users/korfuri/gists{/gist_id}","starred_url":"https://api.github.com/users/korfuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/korfuri/subscriptions","organizations_url":"https://api.github.com/users/korfuri/orgs","repos_url":"https://api.github.com/users/korfuri/repos","events_url":"https://api.github.com/users/korfuri/events{/privacy}","received_events_url":"https://api.github.com/users/korfuri/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/korfuri/PyGithub","description":"Python library implementing the GitHub API v3","fork":true,"url":"https://api.github.com/repos/korfuri/PyGithub","forks_url":"https://api.github.com/repos/korfuri/PyGithub/forks","keys_url":"https://api.github.com/repos/korfuri/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/korfuri/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/korfuri/PyGithub/teams","hooks_url":"https://api.github.com/repos/korfuri/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/korfuri/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/korfuri/PyGithub/events","assignees_url":"https://api.github.com/repos/korfuri/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/korfuri/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/korfuri/PyGithub/tags","blobs_url":"https://api.github.com/repos/korfuri/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/korfuri/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/korfuri/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/korfuri/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/korfuri/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/korfuri/PyGithub/languages","stargazers_url":"https://api.github.com/repos/korfuri/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/korfuri/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/korfuri/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/korfuri/PyGithub/subscription","commits_url":"https://api.github.com/repos/korfuri/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/korfuri/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/korfuri/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/korfuri/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/korfuri/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/korfuri/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/korfuri/PyGithub/merges","archive_url":"https://api.github.com/repos/korfuri/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/korfuri/PyGithub/downloads","issues_url":"https://api.github.com/repos/korfuri/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/korfuri/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/korfuri/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/korfuri/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/korfuri/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/korfuri/PyGithub/releases{/id}","created_at":"2015-03-27T02:56:40Z","updated_at":"2015-03-27T02:56:43Z","pushed_at":"2015-03-18T19:20:30Z","git_url":"git://github.com/korfuri/PyGithub.git","ssh_url":"git@github.com:korfuri/PyGithub.git","clone_url":"https://github.com/korfuri/PyGithub.git","svn_url":"https://github.com/korfuri/PyGithub","homepage":"http://jacquev6.github.io/PyGithub","size":15874,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"parent":{"id":32905113,"name":"PyGithub","full_name":"Jucyio/PyGithub","owner":{"login":"Jucyio","id":11623651,"avatar_url":"https://avatars.githubusercontent.com/u/11623651?v=3","gravatar_id":"","url":"https://api.github.com/users/Jucyio","html_url":"https://github.com/Jucyio","followers_url":"https://api.github.com/users/Jucyio/followers","following_url":"https://api.github.com/users/Jucyio/following{/other_user}","gists_url":"https://api.github.com/users/Jucyio/gists{/gist_id}","starred_url":"https://api.github.com/users/Jucyio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jucyio/subscriptions","organizations_url":"https://api.github.com/users/Jucyio/orgs","repos_url":"https://api.github.com/users/Jucyio/repos","events_url":"https://api.github.com/users/Jucyio/events{/privacy}","received_events_url":"https://api.github.com/users/Jucyio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Jucyio/PyGithub","description":"Python library implementing the GitHub API v3","fork":true,"url":"https://api.github.com/repos/Jucyio/PyGithub","forks_url":"https://api.github.com/repos/Jucyio/PyGithub/forks","keys_url":"https://api.github.com/repos/Jucyio/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jucyio/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jucyio/PyGithub/teams","hooks_url":"https://api.github.com/repos/Jucyio/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/Jucyio/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/Jucyio/PyGithub/events","assignees_url":"https://api.github.com/repos/Jucyio/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/Jucyio/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/Jucyio/PyGithub/tags","blobs_url":"https://api.github.com/repos/Jucyio/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jucyio/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jucyio/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jucyio/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jucyio/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/Jucyio/PyGithub/languages","stargazers_url":"https://api.github.com/repos/Jucyio/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/Jucyio/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/Jucyio/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/Jucyio/PyGithub/subscription","commits_url":"https://api.github.com/repos/Jucyio/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jucyio/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jucyio/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jucyio/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/Jucyio/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/Jucyio/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jucyio/PyGithub/merges","archive_url":"https://api.github.com/repos/Jucyio/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jucyio/PyGithub/downloads","issues_url":"https://api.github.com/repos/Jucyio/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/Jucyio/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/Jucyio/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/Jucyio/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jucyio/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/Jucyio/PyGithub/releases{/id}","created_at":"2015-03-26T03:17:03Z","updated_at":"2015-03-26T03:17:05Z","pushed_at":"2015-03-18T19:20:30Z","git_url":"git://github.com/Jucyio/PyGithub.git","ssh_url":"git@github.com:Jucyio/PyGithub.git","clone_url":"https://github.com/Jucyio/PyGithub.git","svn_url":"https://github.com/Jucyio/PyGithub","homepage":"http://jacquev6.github.io/PyGithub","size":15874,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"},"source":{"id":3544490,"name":"PyGithub","full_name":"PyGithub/PyGithub","owner":{"login":"PyGithub","id":11288996,"avatar_url":"https://avatars.githubusercontent.com/u/11288996?v=3","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PyGithub/PyGithub","description":"Python library implementing the GitHub API v3","fork":false,"url":"https://api.github.com/repos/PyGithub/PyGithub","forks_url":"https://api.github.com/repos/PyGithub/PyGithub/forks","keys_url":"https://api.github.com/repos/PyGithub/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PyGithub/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/teams","hooks_url":"https://api.github.com/repos/PyGithub/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/PyGithub/PyGithub/events","assignees_url":"https://api.github.com/repos/PyGithub/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/PyGithub/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/PyGithub/PyGithub/tags","blobs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PyGithub/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PyGithub/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/PyGithub/PyGithub/languages","stargazers_url":"https://api.github.com/repos/PyGithub/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/PyGithub/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/PyGithub/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/PyGithub/PyGithub/subscription","commits_url":"https://api.github.com/repos/PyGithub/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/PyGithub/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/PyGithub/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PyGithub/PyGithub/merges","archive_url":"https://api.github.com/repos/PyGithub/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PyGithub/PyGithub/downloads","issues_url":"https://api.github.com/repos/PyGithub/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/PyGithub/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/PyGithub/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/PyGithub/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/PyGithub/PyGithub/releases{/id}","created_at":"2012-02-25T12:53:47Z","updated_at":"2015-03-26T14:31:35Z","pushed_at":"2015-03-18T19:20:30Z","git_url":"git://github.com/PyGithub/PyGithub.git","ssh_url":"git@github.com:PyGithub/PyGithub.git","clone_url":"https://github.com/PyGithub/PyGithub.git","svn_url":"https://github.com/PyGithub/PyGithub","homepage":"http://jacquev6.github.io/PyGithub","size":15874,"stargazers_count":559,"watchers_count":559,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":152,"mirror_url":null,"open_issues_count":24,"forks":152,"open_issues":24,"watchers":559,"default_branch":"master"},"network_count":152,"subscribers_count":1} + +https +GET +api.github.com +None +/repos/korfuri/PyGithub +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +null +200 +[('content-length', '13643'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '76d9828c7e4f1d910f7ba069e90ce976'), ('x-oauth-scopes', 'gist, repo, user'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', 'repo'), ('etag', '"4a598c12d70d21ed45f8cc87ca10c0ef"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4958'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '6CE875F7:1A8F:54374C:5514C7D9'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('last-modified', 'Fri, 27 Mar 2015 02:56:43 GMT'), ('date', 'Fri, 27 Mar 2015 03:00:41 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1427427963')] +{"id":32964720,"name":"PyGithub","full_name":"korfuri/PyGithub","owner":{"login":"korfuri","id":1124263,"avatar_url":"https://avatars.githubusercontent.com/u/1124263?v=3","gravatar_id":"","url":"https://api.github.com/users/korfuri","html_url":"https://github.com/korfuri","followers_url":"https://api.github.com/users/korfuri/followers","following_url":"https://api.github.com/users/korfuri/following{/other_user}","gists_url":"https://api.github.com/users/korfuri/gists{/gist_id}","starred_url":"https://api.github.com/users/korfuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/korfuri/subscriptions","organizations_url":"https://api.github.com/users/korfuri/orgs","repos_url":"https://api.github.com/users/korfuri/repos","events_url":"https://api.github.com/users/korfuri/events{/privacy}","received_events_url":"https://api.github.com/users/korfuri/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/korfuri/PyGithub","description":"Python library implementing the GitHub API v3","fork":true,"url":"https://api.github.com/repos/korfuri/PyGithub","forks_url":"https://api.github.com/repos/korfuri/PyGithub/forks","keys_url":"https://api.github.com/repos/korfuri/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/korfuri/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/korfuri/PyGithub/teams","hooks_url":"https://api.github.com/repos/korfuri/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/korfuri/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/korfuri/PyGithub/events","assignees_url":"https://api.github.com/repos/korfuri/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/korfuri/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/korfuri/PyGithub/tags","blobs_url":"https://api.github.com/repos/korfuri/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/korfuri/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/korfuri/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/korfuri/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/korfuri/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/korfuri/PyGithub/languages","stargazers_url":"https://api.github.com/repos/korfuri/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/korfuri/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/korfuri/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/korfuri/PyGithub/subscription","commits_url":"https://api.github.com/repos/korfuri/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/korfuri/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/korfuri/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/korfuri/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/korfuri/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/korfuri/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/korfuri/PyGithub/merges","archive_url":"https://api.github.com/repos/korfuri/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/korfuri/PyGithub/downloads","issues_url":"https://api.github.com/repos/korfuri/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/korfuri/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/korfuri/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/korfuri/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/korfuri/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/korfuri/PyGithub/releases{/id}","created_at":"2015-03-27T02:56:40Z","updated_at":"2015-03-27T02:56:43Z","pushed_at":"2015-03-18T19:20:30Z","git_url":"git://github.com/korfuri/PyGithub.git","ssh_url":"git@github.com:korfuri/PyGithub.git","clone_url":"https://github.com/korfuri/PyGithub.git","svn_url":"https://github.com/korfuri/PyGithub","homepage":"http://jacquev6.github.io/PyGithub","size":15874,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"parent":{"id":32905113,"name":"PyGithub","full_name":"Jucyio/PyGithub","owner":{"login":"Jucyio","id":11623651,"avatar_url":"https://avatars.githubusercontent.com/u/11623651?v=3","gravatar_id":"","url":"https://api.github.com/users/Jucyio","html_url":"https://github.com/Jucyio","followers_url":"https://api.github.com/users/Jucyio/followers","following_url":"https://api.github.com/users/Jucyio/following{/other_user}","gists_url":"https://api.github.com/users/Jucyio/gists{/gist_id}","starred_url":"https://api.github.com/users/Jucyio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jucyio/subscriptions","organizations_url":"https://api.github.com/users/Jucyio/orgs","repos_url":"https://api.github.com/users/Jucyio/repos","events_url":"https://api.github.com/users/Jucyio/events{/privacy}","received_events_url":"https://api.github.com/users/Jucyio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Jucyio/PyGithub","description":"Python library implementing the GitHub API v3","fork":true,"url":"https://api.github.com/repos/Jucyio/PyGithub","forks_url":"https://api.github.com/repos/Jucyio/PyGithub/forks","keys_url":"https://api.github.com/repos/Jucyio/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jucyio/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jucyio/PyGithub/teams","hooks_url":"https://api.github.com/repos/Jucyio/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/Jucyio/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/Jucyio/PyGithub/events","assignees_url":"https://api.github.com/repos/Jucyio/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/Jucyio/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/Jucyio/PyGithub/tags","blobs_url":"https://api.github.com/repos/Jucyio/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jucyio/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jucyio/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jucyio/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jucyio/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/Jucyio/PyGithub/languages","stargazers_url":"https://api.github.com/repos/Jucyio/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/Jucyio/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/Jucyio/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/Jucyio/PyGithub/subscription","commits_url":"https://api.github.com/repos/Jucyio/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jucyio/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jucyio/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jucyio/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/Jucyio/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/Jucyio/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jucyio/PyGithub/merges","archive_url":"https://api.github.com/repos/Jucyio/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jucyio/PyGithub/downloads","issues_url":"https://api.github.com/repos/Jucyio/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/Jucyio/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/Jucyio/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/Jucyio/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jucyio/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/Jucyio/PyGithub/releases{/id}","created_at":"2015-03-26T03:17:03Z","updated_at":"2015-03-26T03:17:05Z","pushed_at":"2015-03-18T19:20:30Z","git_url":"git://github.com/Jucyio/PyGithub.git","ssh_url":"git@github.com:Jucyio/PyGithub.git","clone_url":"https://github.com/Jucyio/PyGithub.git","svn_url":"https://github.com/Jucyio/PyGithub","homepage":"http://jacquev6.github.io/PyGithub","size":15874,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"},"source":{"id":3544490,"name":"PyGithub","full_name":"PyGithub/PyGithub","owner":{"login":"PyGithub","id":11288996,"avatar_url":"https://avatars.githubusercontent.com/u/11288996?v=3","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PyGithub/PyGithub","description":"Python library implementing the GitHub API v3","fork":false,"url":"https://api.github.com/repos/PyGithub/PyGithub","forks_url":"https://api.github.com/repos/PyGithub/PyGithub/forks","keys_url":"https://api.github.com/repos/PyGithub/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PyGithub/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/teams","hooks_url":"https://api.github.com/repos/PyGithub/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/PyGithub/PyGithub/events","assignees_url":"https://api.github.com/repos/PyGithub/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/PyGithub/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/PyGithub/PyGithub/tags","blobs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PyGithub/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PyGithub/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/PyGithub/PyGithub/languages","stargazers_url":"https://api.github.com/repos/PyGithub/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/PyGithub/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/PyGithub/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/PyGithub/PyGithub/subscription","commits_url":"https://api.github.com/repos/PyGithub/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/PyGithub/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/PyGithub/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PyGithub/PyGithub/merges","archive_url":"https://api.github.com/repos/PyGithub/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PyGithub/PyGithub/downloads","issues_url":"https://api.github.com/repos/PyGithub/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/PyGithub/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/PyGithub/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/PyGithub/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/PyGithub/PyGithub/releases{/id}","created_at":"2012-02-25T12:53:47Z","updated_at":"2015-03-26T14:31:35Z","pushed_at":"2015-03-18T19:20:30Z","git_url":"git://github.com/PyGithub/PyGithub.git","ssh_url":"git@github.com:PyGithub/PyGithub.git","clone_url":"https://github.com/PyGithub/PyGithub.git","svn_url":"https://github.com/PyGithub/PyGithub","homepage":"http://jacquev6.github.io/PyGithub","size":15874,"stargazers_count":559,"watchers_count":559,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":152,"mirror_url":null,"open_issues_count":24,"forks":152,"open_issues":24,"watchers":559,"default_branch":"master"},"network_count":152,"subscribers_count":1} + diff --git a/github/tests/Repository.py b/github/tests/Repository.py index 1f8fdc9a..6daed2ef 100644 --- a/github/tests/Repository.py +++ b/github/tests/Repository.py @@ -492,3 +492,30 @@ class Repository(Framework.TestCase): stats = self.repo.get_stats_punch_card() self.assertEqual(stats.get(4, 12), 7) self.assertEqual(stats.get(6, 18), 2) + + +class LazyRepository(Framework.TestCase): + + def setUp(self): + Framework.TestCase.setUp(self) + self.user = self.g.get_user() + self.repository_name = '%s/%s' % (self.user.login, "PyGithub") + + def getLazyRepository(self): + return self.g.get_repo(self.repository_name, lazy=True) + + def getEagerRepository(self): + return self.g.get_repo(self.repository_name, lazy=False) + + def testGetIssues(self): + lazy_repo = self.getLazyRepository() + issues = lazy_repo.get_issues() + eager_repo = self.getEagerRepository() + issues2 = eager_repo.get_issues() + self.assertListKeyEqual(issues2, id, [x for x in issues]) + + def testOwner(self): + lazy_repo = self.getLazyRepository() + owner = lazy_repo.owner + eager_repo = self.getEagerRepository() + self.assertEqual(owner, eager_repo.owner)