diff --git a/JsonDescriptionOfGithubApiV3/description.000.human_readable.json b/JsonDescriptionOfGithubApiV3/description.000.human_readable.json index 00f06a2d..ef391291 100644 --- a/JsonDescriptionOfGithubApiV3/description.000.human_readable.json +++ b/JsonDescriptionOfGithubApiV3/description.000.human_readable.json @@ -558,7 +558,6 @@ { "name": "GitTree", "attributes": [ - { "name": "recursive", "type": "@todo" }, { "name": "sha", "type": "@todo" }, { "name": "tree", "type": "@todo" }, { "name": "url", "type": "@todo" } diff --git a/JsonDescriptionOfGithubApiV3/description.001.normalized.json b/JsonDescriptionOfGithubApiV3/description.001.normalized.json index 30255f7a..3d5ffe90 100644 --- a/JsonDescriptionOfGithubApiV3/description.001.normalized.json +++ b/JsonDescriptionOfGithubApiV3/description.001.normalized.json @@ -3169,14 +3169,6 @@ }, { "attributes": [ - { - "type": { - "simple": true, - "cardinality": "scalar", - "name": "@todo" - }, - "name": "recursive" - }, { "type": { "simple": true, diff --git a/NewIntegrationTest.py b/NewIntegrationTest.py index 90e7a062..6c39728d 100644 --- a/NewIntegrationTest.py +++ b/NewIntegrationTest.py @@ -83,6 +83,7 @@ class ReplayingHttpsConnection: class TestCase( unittest.TestCase ): def setUp( self ): + self.__record = False unittest.TestCase.setUp( self ) self.__fileName = "" self.__file = None @@ -90,8 +91,10 @@ class TestCase( unittest.TestCase ): self.g = github.Github( "login", "password" ) def setUpForRecord( self ): + self.__record = True import GithubCredentials unittest.TestCase.setUp( self ) + self.__fileName = "" self.__file = None httplib.HTTPSConnection = lambda *args, **kwds: RecordingHttpsConnection( self.__openFile( "w" ), *args, **kwds ) self.g = github.Github( GithubCredentials.login, GithubCredentials.password ) @@ -116,7 +119,8 @@ class TestCase( unittest.TestCase ): def __closeReplayFileIfNeeded( self ): if self.__file is not None: - self.assertEqual( self.__file.readline(), "" ) + if not self.__record: + self.assertEqual( self.__file.readline(), "" ) self.__file.close() class AuthenticatedUser( TestCase ): @@ -240,6 +244,19 @@ class Repository( TestCase ): self.assertEqual( self.r.url, "https://api.github.com/repos/jacquev6/PyGithub" ) self.assertEqual( self.r.watchers, 13 ) +class GitTree( TestCase ): + def setUp( self ): + TestCase.setUp( self ) + self.t = self.g.get_user().get_repo( "PyGithub" ).get_git_tree( "f492784d8ca837779650d1fb406a1a3587a764ad" ) + + def tearDown( self ): + TestCase.tearDown( self ) + + def testAttributes( self ): + self.assertEqual( self.t.sha, "f492784d8ca837779650d1fb406a1a3587a764ad" ) + self.assertEqual( len( self.t.tree ), 11 ) + self.assertEqual( self.t.url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad" ) + if len( sys.argv ) > 1 and sys.argv[ 1 ] == "--record": for method in sys.argv[ 2 : ]: class_, method = method.split( "." ) diff --git a/ReferenceOfClasses.md b/ReferenceOfClasses.md index edd6e9ea..35632e60 100644 --- a/ReferenceOfClasses.md +++ b/ReferenceOfClasses.md @@ -409,7 +409,6 @@ Class `GitTree` Attributes ---------- -* `recursive` * `sha` * `tree` * `url` diff --git a/ReplayDataForNewIntegrationTest/GitTree.setUp.txt b/ReplayDataForNewIntegrationTest/GitTree.setUp.txt new file mode 100644 index 00000000..0b137537 --- /dev/null +++ b/ReplayDataForNewIntegrationTest/GitTree.setUp.txt @@ -0,0 +1,15 @@ +GET /user {} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4979'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"b6d3e574cac0625e38d197bb7db412f9"'), ('date', 'Wed, 09 May 2012 11:07:58 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"private_gists":5,"type":"User","blog":"http://vincent-jacques.net","html_url":"https://github.com/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","following":24,"company":"Criteo","hireable":false,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","bio":"","followers":13,"url":"https://api.github.com/users/jacquev6","total_private_repos":5,"public_repos":10,"login":"jacquev6","collaborators":0,"email":"vincent@vincent-jacques.net","owned_private_repos":5,"disk_usage":16696,"plan":{"collaborators":1,"private_repos":5,"space":614400,"name":"micro"},"created_at":"2010-07-09T06:10:06Z","name":"Vincent Jacques","public_gists":1,"id":327146,"location":"Paris, France"} + +GET /repos/jacquev6/PyGithub {} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4978'), ('content-length', '1097'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"c0293af46a4d4655e9bc13372866ea14"'), ('date', 'Wed, 09 May 2012 11:08:02 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"homepage":"http://vincent-jacques.net/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","html_url":"https://github.com/jacquev6/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","has_downloads":true,"watchers":13,"permissions":{"admin":true,"pull":true,"push":true},"has_wiki":false,"has_issues":true,"fork":false,"forks":2,"mirror_url":null,"language":"Python","size":212,"description":"Python library implementing the full Github API v3","private":false,"created_at":"2012-02-25T12:53:47Z","open_issues":15,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146},"name":"PyGithub","git_url":"git://github.com/jacquev6/PyGithub.git","pushed_at":"2012-05-08T19:27:43Z","id":3544490,"ssh_url":"git@github.com:jacquev6/PyGithub.git","updated_at":"2012-05-08T19:27:43Z"} + +GET /repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad {} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4977'), ('content-length', '2588'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"48de06b16b68f8342a2827cea83e2b86"'), ('date', 'Wed, 09 May 2012 11:08:02 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"tree":[{"type":"blob","sha":"8a9af1462c3f4e3358315c2d2e6ef1e7334c59dd","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/8a9af1462c3f4e3358315c2d2e6ef1e7334c59dd","size":53,"path":".gitignore","mode":"100644"},{"type":"blob","sha":"7863d93a3ef3700fd05d2e0e6b9c1b5161c4572b","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/7863d93a3ef3700fd05d2e0e6b9c1b5161c4572b","size":1832,"path":"Design.md","mode":"100644"},{"type":"blob","sha":"82be8f1b97c4cfb005ad9ce8b8215c2f71470630","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/82be8f1b97c4cfb005ad9ce8b8215c2f71470630","size":28643,"path":"IntegrationTest.py","mode":"100644"},{"type":"blob","sha":"8da6802f0b9d4acd1945440053dfd6be3ee80c95","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/8da6802f0b9d4acd1945440053dfd6be3ee80c95","size":3153,"path":"ReadMe.md","mode":"100644"},{"type":"blob","sha":"3ee24565835d6a352e0ce37b1f2413572f55e368","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/3ee24565835d6a352e0ce37b1f2413572f55e368","size":12687,"path":"ReferenceOfApis.md","mode":"100644"},{"type":"blob","sha":"af9d09559eb6dae86af23b81e6ddcebfa4dc37e6","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/af9d09559eb6dae86af23b81e6ddcebfa4dc37e6","size":15967,"path":"ReferenceOfClasses.md","mode":"100644"},{"type":"tree","sha":"60b4602b2c2070246c5df078fb7a5150b45815eb","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/60b4602b2c2070246c5df078fb7a5150b45815eb","path":"ReplayDataForIntegrationTest","mode":"040000"},{"type":"blob","sha":"61cfa6bc84a562c134770b1e10445e7b810dbc26","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/61cfa6bc84a562c134770b1e10445e7b810dbc26","size":320,"path":"RoadMap.md","mode":"100644"},{"type":"tree","sha":"929f19535e74d80fb117aa021742ce2556ddc9a2","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/929f19535e74d80fb117aa021742ce2556ddc9a2","path":"github","mode":"040000"},{"type":"blob","sha":"9532bcaa5fcc0a9d3678b3e4fd05688e32d2a321","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/9532bcaa5fcc0a9d3678b3e4fd05688e32d2a321","size":673,"path":"run_tests.sh","mode":"100644"},{"type":"blob","sha":"53bce9fa919b4544e67275089b3ec5b44be20667","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/53bce9fa919b4544e67275089b3ec5b44be20667","size":1295,"path":"setup.py","mode":"100644"}],"sha":"f492784d8ca837779650d1fb406a1a3587a764ad","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad"} + diff --git a/ReplayDataForNewIntegrationTest/GitTree.testAttributes.txt b/ReplayDataForNewIntegrationTest/GitTree.testAttributes.txt new file mode 100644 index 00000000..e69de29b diff --git a/github/GithubObjects/GitTree.py b/github/GithubObjects/GitTree.py index 7c596f20..3012f814 100644 --- a/github/GithubObjects/GitTree.py +++ b/github/GithubObjects/GitTree.py @@ -17,11 +17,6 @@ class GitTree( object ): if not lazy: self.__complete() - @property - def recursive( self ): - self.__completeIfNeeded( self.__recursive ) - return self.__recursive - @property def sha( self ): self.__completeIfNeeded( self.__sha ) @@ -38,7 +33,6 @@ class GitTree( object ): return self.__url def __initAttributes( self ): - self.__recursive = None self.__sha = None self.__tree = None self.__url = None @@ -59,8 +53,6 @@ class GitTree( object ): def __useAttributes( self, attributes ): #@todo No need to check if attribute is in attributes when attribute is mandatory - if "recursive" in attributes and attributes[ "recursive" ] is not None: - self.__recursive = attributes[ "recursive" ] if "sha" in attributes and attributes[ "sha" ] is not None: self.__sha = attributes[ "sha" ] if "tree" in attributes and attributes[ "tree" ] is not None: diff --git a/github/GithubObjects/Repository.py b/github/GithubObjects/Repository.py index a6b47485..3878dfe6 100644 --- a/github/GithubObjects/Repository.py +++ b/github/GithubObjects/Repository.py @@ -594,7 +594,7 @@ class Repository( object ): def get_git_tree( self, sha, recursive = DefaultValueForOptionalParameters ): status, headers, data = self.__requester.request( "GET", - str( self.url ) + "/git_trees" + "/" + str( sha ), + str( self.url ) + "/git/trees" + "/" + str( sha ), None, None )