Get repo from full name: tests, doc, fix param name (Pull #121)

This commit is contained in:
Vincent Jacques
2012-12-21 20:38:29 +01:00
parent 84cc70e78c
commit 64ec395298
6 changed files with 18 additions and 4 deletions
+5
View File
@@ -13,6 +13,11 @@ What's new?
[![Build Status](https://secure.travis-ci.org/jacquev6/PyGithub.png)](http://travis-ci.org/jacquev6/PyGithub)
Next version
------------
* Add a shortcut function `Github.get_repo` to get a repo directly from its full name. thank you [lwc](https://github.com/lwc) for the contribution
[Version 1.9.1](https://github.com/jacquev6/PyGithub/issues?milestone=17&state=closed) (November 20th, 2012)
------------------------------------------------------------------------------------------------------------
+1 -1
View File
@@ -133,7 +133,7 @@ API `/rate_limit`
API `/repos/:user/:repo`
========================
* GET: `AuthenticatedUser.get_repo`, `NamedUser.get_repo` or `Organization.get_repo`
* GET: `AuthenticatedUser.get_repo`, `NamedUser.get_repo`, `Organization.get_repo` or `Github.get_repo`
* PATCH: `Repository.edit`
* DELETE: `Repository.delete`
+1
View File
@@ -26,6 +26,7 @@ Methods
* `get_user()`: `AuthenticatedUser`
* `get_user( login )`: `NamedUser`
* `get_organization( login )`: `Organization`
* `get_repo( full_name )`: `Repository`
* `get_gist( id )`: `Gist`
* `id`: string
* `get_gists()`: `PaginatedList` of `Gist`
+3 -3
View File
@@ -70,11 +70,11 @@ class Github(object):
)
return Organization.Organization(self.__requester, data, completed=True)
def get_repo(self, path):
assert isinstance(path, (str, unicode)), name
def get_repo(self, full_name):
assert isinstance(full_name, (str, unicode)), full_name
headers, data = self.__requester.requestAndCheck(
"GET",
"/repos/" + path,
"/repos/" + full_name,
None,
None
)
+3
View File
@@ -92,3 +92,6 @@ class Github(Framework.TestCase):
self.assertEqual(hook.supported_events, ["push"])
self.assertEqual(hook.events, ["push"])
self.assertEqual(hook.schema, [["string", "url"], ["string", "token"], ["string", "project_id"], ["string", "milestone_id"], ["string", "category_id"]])
def testGetRepoFromFullName(self):
self.assertEqual(self.g.get_repo("jacquev6/PyGithub").description, "Python library implementing the full Github API v3")
@@ -0,0 +1,5 @@
https GET api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4939'), ('content-length', '1097'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"922c0519f2733063a899619ae95ce892"'), ('date', 'Sun, 20 May 2012 12:33:27 GMT'), ('content-type', 'application/json; charset=utf-8')]
{"svn_url":"https://github.com/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"updated_at":"2012-05-19T10:50:39Z","forks":2,"homepage":"http://vincent-jacques.net/PyGithub","git_url":"git://github.com/jacquev6/PyGithub.git","url":"https://api.github.com/repos/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","open_issues":18,"fork":false,"ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-19T10:50:39Z","size":304,"private":false,"has_downloads":true,"watchers":13,"html_url":"https://github.com/jacquev6/PyGithub","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","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,"mirror_url":null}