diff --git a/codegen/JsonDescriptionOfGithubApiV3/description.000.human_readable.json b/codegen/JsonDescriptionOfGithubApiV3/description.000.human_readable.json index 8c787b44..e9877b44 100644 --- a/codegen/JsonDescriptionOfGithubApiV3/description.000.human_readable.json +++ b/codegen/JsonDescriptionOfGithubApiV3/description.000.human_readable.json @@ -1708,9 +1708,9 @@ { "name": "Tag", "attributes": [ - { "name": "name", "type": "@todo" }, - { "name": "tarball_url", "type": "@todo" }, - { "name": "zipball_url", "type": "@todo" }, + { "name": "name", "type": "string" }, + { "name": "tarball_url", "type": "string" }, + { "name": "zipball_url", "type": "string" }, { "name": "commit", "type": "Commit" } ], "collections": [ diff --git a/codegen/JsonDescriptionOfGithubApiV3/description.001.normalized.json b/codegen/JsonDescriptionOfGithubApiV3/description.001.normalized.json index 45785ba2..755d2bfb 100644 --- a/codegen/JsonDescriptionOfGithubApiV3/description.001.normalized.json +++ b/codegen/JsonDescriptionOfGithubApiV3/description.001.normalized.json @@ -9963,7 +9963,7 @@ "type": { "simple": true, "cardinality": "scalar", - "name": "@todo" + "name": "string" }, "name": "name" }, @@ -9971,7 +9971,7 @@ "type": { "simple": true, "cardinality": "scalar", - "name": "@todo" + "name": "string" }, "name": "tarball_url" }, @@ -9979,7 +9979,7 @@ "type": { "simple": true, "cardinality": "scalar", - "name": "@todo" + "name": "string" }, "name": "zipball_url" } diff --git a/doc/ReferenceOfClasses.md b/doc/ReferenceOfClasses.md index 685817ed..89910183 100644 --- a/doc/ReferenceOfClasses.md +++ b/doc/ReferenceOfClasses.md @@ -1193,9 +1193,9 @@ Class `Tag` Attributes ---------- * `commit`: `Commit` -* `name` -* `tarball_url` -* `zipball_url` +* `name`: string +* `tarball_url`: string +* `zipball_url`: string Class `Team` ============ diff --git a/src/github/Tag.py b/src/github/Tag.py index fb0c35ca..cb030073 100644 --- a/src/github/Tag.py +++ b/src/github/Tag.py @@ -43,8 +43,11 @@ class Tag( object ): assert isinstance( attributes[ "commit" ], dict ) self.__commit = Commit.Commit( self.__requester, attributes[ "commit" ], completion = LazyCompletion ) if "name" in attributes and attributes[ "name" ] is not None: + assert isinstance( attributes[ "name" ], ( str, unicode ) ) self.__name = attributes[ "name" ] if "tarball_url" in attributes and attributes[ "tarball_url" ] is not None: + assert isinstance( attributes[ "tarball_url" ], ( str, unicode ) ) self.__tarball_url = attributes[ "tarball_url" ] if "zipball_url" in attributes and attributes[ "zipball_url" ] is not None: + assert isinstance( attributes[ "zipball_url" ], ( str, unicode ) ) self.__zipball_url = attributes[ "zipball_url" ] diff --git a/test/GitObjects.py b/test/GitObjects.py index 2413d65b..8711000e 100644 --- a/test/GitObjects.py +++ b/test/GitObjects.py @@ -59,6 +59,14 @@ class Branch( Framework.TestCaseWithRepo ): self.assertEqual( comment.url, "https://api.github.com/repos/jacquev6/PyGithub/comments/1349654" ) self.assertEqual( comment.user.login, "jacquev6" ) +class Tag( Framework.TestCaseWithRepo ): + def testAttributes( self ): + tag = self.repo.get_tags()[ 0 ] + self.assertEqual( tag.commit.sha, "636e6112deb72277b3bffcc3303cd7e8a7431a5d" ) + self.assertEqual( tag.name, "v0.3" ) + self.assertEqual( tag.tarball_url, "https://github.com/jacquev6/PyGithub/tarball/v0.3" ) + self.assertEqual( tag.zipball_url, "https://github.com/jacquev6/PyGithub/zipball/v0.3" ) + class GitBlob( Framework.TestCaseWithRepo ): def testAttributes( self ): blob = self.repo.get_git_blob( "53bce9fa919b4544e67275089b3ec5b44be20667" ) diff --git a/test/ReplayData/Tag.setUp.txt b/test/ReplayData/Tag.setUp.txt new file mode 100644 index 00000000..daeba961 --- /dev/null +++ b/test/ReplayData/Tag.setUp.txt @@ -0,0 +1,10 @@ +GET /user {} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4999'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"9de15de3e62b82f61ccc4ffeadea7f9f"'), ('date', 'Sat, 19 May 2012 04:49:44 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"collaborators":0,"type":"User","public_gists":1,"company":"Criteo","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","total_private_repos":5,"private_gists":5,"plan":{"collaborators":1,"private_repos":5,"name":"micro","space":614400},"public_repos":11,"followers":13,"owned_private_repos":5,"hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","bio":"","disk_usage":16768,"html_url":"https://github.com/jacquev6","name":"Vincent Jacques","created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"following":24} + +GET /repos/jacquev6/PyGithub {} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4998'), ('content-length', '1097'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"168623303cdf933a5eda91a18bb2ad76"'), ('date', 'Sat, 19 May 2012 04:49:44 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"mirror_url":null,"svn_url":"https://github.com/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"git_url":"git://github.com/jacquev6/PyGithub.git","updated_at":"2012-05-18T20:30:15Z","forks":2,"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","open_issues":17,"fork":false,"ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-18T20:30:14Z","size":220,"private":false,"has_downloads":true,"watchers":13,"html_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146},"name":"PyGithub","permissions":{"pull":true,"admin":true,"push":true},"language":"Python","description":"Python library implementing the full Github API v3","created_at":"2012-02-25T12:53:47Z","id":3544490} + diff --git a/test/ReplayData/Tag.testAttributes.txt b/test/ReplayData/Tag.testAttributes.txt new file mode 100644 index 00000000..a4739b66 --- /dev/null +++ b/test/ReplayData/Tag.testAttributes.txt @@ -0,0 +1,5 @@ +GET /repos/jacquev6/PyGithub/tags {} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4997'), ('content-length', '1873'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d43a1ebbb23a4f99f4fbac19caadc4af"'), ('date', 'Sat, 19 May 2012 04:49:45 GMT'), ('content-type', 'application/json; charset=utf-8')] +[{"zipball_url":"https://github.com/jacquev6/PyGithub/zipball/v0.3","tarball_url":"https://github.com/jacquev6/PyGithub/tarball/v0.3","name":"v0.3","commit":{"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/636e6112deb72277b3bffcc3303cd7e8a7431a5d","sha":"636e6112deb72277b3bffcc3303cd7e8a7431a5d"}},{"zipball_url":"https://github.com/jacquev6/PyGithub/zipball/v0.4","tarball_url":"https://github.com/jacquev6/PyGithub/tarball/v0.4","name":"v0.4","commit":{"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a3be28756101370fbc689eec3a7825c4c385a6c9","sha":"a3be28756101370fbc689eec3a7825c4c385a6c9"}},{"zipball_url":"https://github.com/jacquev6/PyGithub/zipball/v0.5","tarball_url":"https://github.com/jacquev6/PyGithub/tarball/v0.5","name":"v0.5","commit":{"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/936f4a97f1a86392637ec002bbf89ff036a5062d","sha":"936f4a97f1a86392637ec002bbf89ff036a5062d"}},{"zipball_url":"https://github.com/jacquev6/PyGithub/zipball/v0.6","tarball_url":"https://github.com/jacquev6/PyGithub/tarball/v0.6","name":"v0.6","commit":{"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/4303c5b90e2216d927155e9609436ccb8984c495","sha":"4303c5b90e2216d927155e9609436ccb8984c495"}},{"zipball_url":"https://github.com/jacquev6/PyGithub/zipball/v0.1","tarball_url":"https://github.com/jacquev6/PyGithub/tarball/v0.1","name":"v0.1","commit":{"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/dbdcda3591980de42617814f792969126e6402c3","sha":"dbdcda3591980de42617814f792969126e6402c3"}},{"zipball_url":"https://github.com/jacquev6/PyGithub/zipball/v0.2","tarball_url":"https://github.com/jacquev6/PyGithub/tarball/v0.2","name":"v0.2","commit":{"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/9f0b05161f9d1962b9156e6c91fc04f382028240","sha":"9f0b05161f9d1962b9156e6c91fc04f382028240"}}] +