mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
Expose raw data of objects (Issue #144)
This commit is contained in:
@@ -54,6 +54,7 @@ from PaginatedList import *
|
||||
from Exceptions import *
|
||||
from Enterprise import *
|
||||
from Logging_ import *
|
||||
from RawData import *
|
||||
|
||||
from Issue33 import *
|
||||
from Issue50 import *
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2012 Vincent Jacques
|
||||
# vincent@vincent-jacques.net
|
||||
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/
|
||||
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
|
||||
# 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
|
||||
|
||||
class RawData(Framework.TestCase):
|
||||
jacquev6RawData = {
|
||||
u'disk_usage': 13812,
|
||||
u'private_gists': 5,
|
||||
u'public_repos': 21,
|
||||
u'subscriptions_url': u'https://api.github.com/users/jacquev6/subscriptions',
|
||||
u'gravatar_id': u'b68de5ae38616c296fa345d2b9df2225',
|
||||
u'hireable': False,
|
||||
u'id': 327146,
|
||||
u'followers_url': u'https://api.github.com/users/jacquev6/followers',
|
||||
u'following_url': u'https://api.github.com/users/jacquev6/following',
|
||||
u'collaborators': 1,
|
||||
u'total_private_repos': 4,
|
||||
u'blog': u'http://vincent-jacques.net',
|
||||
u'followers': 22,
|
||||
u'location': u'Paris, France',
|
||||
u'type': u'User',
|
||||
u'email': u'vincent@vincent-jacques.net',
|
||||
u'bio': u'',
|
||||
u'gists_url': u'https://api.github.com/users/jacquev6/gists{/gist_id}',
|
||||
u'owned_private_repos': 4,
|
||||
u'company': u'Criteo',
|
||||
u'events_url': u'https://api.github.com/users/jacquev6/events{/privacy}',
|
||||
u'html_url': u'https://github.com/jacquev6',
|
||||
u'updated_at': u'2013-03-12T22:13:32Z',
|
||||
u'plan': {
|
||||
u'collaborators': 1,
|
||||
u'name': u'micro',
|
||||
u'private_repos': 5,
|
||||
u'space': 614400,
|
||||
},
|
||||
u'received_events_url': u'https://api.github.com/users/jacquev6/received_events',
|
||||
u'starred_url': u'https://api.github.com/users/jacquev6/starred{/owner}{/repo}',
|
||||
u'public_gists': 2,
|
||||
u'name': u'Vincent Jacques',
|
||||
u'organizations_url': u'https://api.github.com/users/jacquev6/orgs',
|
||||
u'url': u'https://api.github.com/users/jacquev6',
|
||||
u'created_at': u'2010-07-09T06:10:06Z',
|
||||
u'avatar_url': u'https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png',
|
||||
u'repos_url': u'https://api.github.com/users/jacquev6/repos',
|
||||
u'following': 38,
|
||||
u'login': u'jacquev6',
|
||||
}
|
||||
|
||||
planRawData = {
|
||||
u'collaborators': 1,
|
||||
u'name': u'micro',
|
||||
u'private_repos': 5,
|
||||
u'space': 614400,
|
||||
}
|
||||
|
||||
def testCompletedObject(self):
|
||||
user = self.g.get_user("jacquev6")
|
||||
self.assertTrue(user._GithubObject__completed)
|
||||
self.assertEqual(user.raw_data, RawData.jacquev6RawData)
|
||||
|
||||
def testNotYetCompletedObject(self):
|
||||
user = self.g.get_user().get_repo("PyGithub").owner
|
||||
self.assertFalse(user._GithubObject__completed)
|
||||
self.assertEqual(user.raw_data, RawData.jacquev6RawData)
|
||||
self.assertTrue(user._GithubObject__completed)
|
||||
|
||||
def testNonCompletableObject(self):
|
||||
plan = self.g.get_user().plan
|
||||
self.assertEqual(plan.raw_data, RawData.planRawData)
|
||||
@@ -0,0 +1,5 @@
|
||||
https GET api.github.com None /users/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4988'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '1464'), ('server', 'GitHub.com'), ('last-modified', 'Tue, 12 Mar 2013 22:13:32 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1bb2632b6c4ebeb4ff568329490bfbe2"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 13 Mar 2013 13:13:30 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"login":"jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","name":"Vincent Jacques","company":"Criteo","blog":"http://vincent-jacques.net","location":"Paris, France","email":"vincent@vincent-jacques.net","hireable":false,"bio":"","public_repos":21,"followers":22,"following":38,"created_at":"2010-07-09T06:10:06Z","updated_at":"2013-03-12T22:13:32Z","public_gists":2,"total_private_repos":4,"owned_private_repos":4,"disk_usage":13812,"collaborators":1,"plan":{"name":"micro","space":614400,"collaborators":1,"private_repos":5},"private_gists":5}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
https GET api.github.com None /user {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4987'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '1464'), ('server', 'GitHub.com'), ('last-modified', 'Tue, 12 Mar 2013 22:13:32 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1bb2632b6c4ebeb4ff568329490bfbe2"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 13 Mar 2013 13:13:31 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"login":"jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","name":"Vincent Jacques","company":"Criteo","blog":"http://vincent-jacques.net","location":"Paris, France","email":"vincent@vincent-jacques.net","hireable":false,"bio":"","public_repos":21,"followers":22,"following":38,"created_at":"2010-07-09T06:10:06Z","updated_at":"2013-03-12T22:13:32Z","public_gists":2,"total_private_repos":4,"owned_private_repos":4,"disk_usage":13812,"collaborators":1,"plan":{"name":"micro","space":614400,"collaborators":1,"private_repos":5},"private_gists":5}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
https GET api.github.com None /user {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4986'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '1464'), ('server', 'GitHub.com'), ('last-modified', 'Tue, 12 Mar 2013 22:13:32 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1bb2632b6c4ebeb4ff568329490bfbe2"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 13 Mar 2013 13:13:31 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"login":"jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","name":"Vincent Jacques","company":"Criteo","blog":"http://vincent-jacques.net","location":"Paris, France","email":"vincent@vincent-jacques.net","hireable":false,"bio":"","public_repos":21,"followers":22,"following":38,"created_at":"2010-07-09T06:10:06Z","updated_at":"2013-03-12T22:13:32Z","public_gists":2,"total_private_repos":4,"owned_private_repos":4,"disk_usage":13812,"collaborators":1,"plan":{"name":"micro","space":614400,"collaborators":1,"private_repos":5},"private_gists":5}
|
||||
|
||||
https GET api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '4656'), ('server', 'GitHub.com'), ('last-modified', 'Tue, 12 Mar 2013 22:13:32 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1bb2632b6c4ebeb4ff568329490bfbe2"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 13 Mar 2013 13:13:31 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"id":3544490,"name":"PyGithub","full_name":"jacquev6/PyGithub","owner":{"login":"jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User"},"private":false,"html_url":"https://github.com/jacquev6/PyGithub","description":"Python library implementing the full Github API v3","fork":false,"url":"https://api.github.com/repos/jacquev6/PyGithub","forks_url":"https://api.github.com/repos/jacquev6/PyGithub/forks","keys_url":"https://api.github.com/repos/jacquev6/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacquev6/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacquev6/PyGithub/teams","hooks_url":"https://api.github.com/repos/jacquev6/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/jacquev6/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/jacquev6/PyGithub/events","assignees_url":"https://api.github.com/repos/jacquev6/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/jacquev6/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/jacquev6/PyGithub/tags{/tag}","blobs_url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacquev6/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacquev6/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacquev6/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/jacquev6/PyGithub/languages","stargazers_url":"https://api.github.com/repos/jacquev6/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/jacquev6/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/jacquev6/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/jacquev6/PyGithub/subscription","commits_url":"https://api.github.com/repos/jacquev6/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacquev6/PyGithub/issues/comments/{number}","contents_url":"https://api.github.com/repos/jacquev6/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/jacquev6/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacquev6/PyGithub/merges","archive_url":"https://api.github.com/repos/jacquev6/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacquev6/PyGithub/downloads","issues_url":"https://api.github.com/repos/jacquev6/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/jacquev6/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/jacquev6/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/jacquev6/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacquev6/PyGithub/labels{/name}","created_at":"2012-02-25T12:53:47Z","updated_at":"2013-03-12T22:13:32Z","pushed_at":"2013-03-12T09:25:23Z","git_url":"git://github.com/jacquev6/PyGithub.git","ssh_url":"git@github.com:jacquev6/PyGithub.git","clone_url":"https://github.com/jacquev6/PyGithub.git","svn_url":"https://github.com/jacquev6/PyGithub","homepage":"http://jacquev6.github.com/PyGithub","size":416,"watchers_count":167,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":47,"mirror_url":null,"open_issues_count":13,"forks":47,"open_issues":13,"watchers":167,"master_branch":"master","default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"network_count":47}
|
||||
|
||||
https GET api.github.com None /users/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4984'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '1464'), ('server', 'GitHub.com'), ('last-modified', 'Tue, 12 Mar 2013 22:13:32 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1bb2632b6c4ebeb4ff568329490bfbe2"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 13 Mar 2013 13:13:32 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"login":"jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","name":"Vincent Jacques","company":"Criteo","blog":"http://vincent-jacques.net","location":"Paris, France","email":"vincent@vincent-jacques.net","hireable":false,"bio":"","public_repos":21,"followers":22,"following":38,"created_at":"2010-07-09T06:10:06Z","updated_at":"2013-03-12T22:13:32Z","public_gists":2,"total_private_repos":4,"owned_private_repos":4,"disk_usage":13812,"collaborators":1,"plan":{"name":"micro","space":614400,"collaborators":1,"private_repos":5},"private_gists":5}
|
||||
|
||||
Reference in New Issue
Block a user