mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Implement GET /users (issue #173)
This commit is contained in:
+18
-1
@@ -99,7 +99,7 @@ class Github(object):
|
||||
|
||||
def get_user(self, login=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /users/:user <http://developer.github.com/v3/todo>`_
|
||||
:calls: `GET /users/:user <http://developer.github.com/v3/users/#get-a-single-user>`_ or `GET /user <http://developer.github.com/v3/users/#get-the-authenticated-user>`_
|
||||
:param login: string
|
||||
:rtype: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
@@ -115,6 +115,23 @@ class Github(object):
|
||||
)
|
||||
return github.NamedUser.NamedUser(self.__requester, data, completed=True)
|
||||
|
||||
def get_users(self, since=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /users <http://developer.github.com/v3/users/#get-all-users>`_
|
||||
:param since: integer
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
assert since is github.GithubObject.NotSet or isinstance(since, (int, long)), since
|
||||
url_parameters = dict()
|
||||
if since is not github.GithubObject.NotSet:
|
||||
url_parameters["since"] = since
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.NamedUser.NamedUser,
|
||||
self.__requester,
|
||||
"/users",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_organization(self, login):
|
||||
"""
|
||||
:calls: `GET /orgs/:org <http://developer.github.com/v3/todo>`_
|
||||
|
||||
@@ -113,3 +113,9 @@ class Github(Framework.TestCase):
|
||||
|
||||
def testStringOfNotSet(self):
|
||||
self.assertEqual(str(github.GithubObject.NotSet), "NotSet")
|
||||
|
||||
def testGetUsers(self):
|
||||
self.assertListKeyBegin(self.g.get_users(), lambda u: u.login, ["mojombo","defunkt","pjhyett","wycats","ezmobius","ivey","evanphx","vanpelt","wayneeseguin","brynary","kevinclark","technoweenie","macournoyer","takeo","Caged","topfunky","anotherjesse","roland","lukas","fanvsfan","tomtt","railsjitsu","nitay","kevwil","KirinDave","jamesgolick","atmos","errfree","mojodna","bmizerany","jnewland","joshknowles","hornbeck","jwhitmire","elbowdonkey","reinh","timocratic","bs","rsanheim","schacon","uggedal","bruce","sam","mmower","abhay","rabble","benburkert","indirect","fearoffish","ry","engineyard","jsierles","tweibley","peimei","brixen","tmornini","outerim","daksis","sr","lifo","rsl","imownbey","dylanegan","jm","willcodeforfoo","jvantuyl","BrianTheCoder","freeformz","hassox","automatthew","queso","lancecarlson","drnic","lukesutton","danwrong","hcatlin","jfrost","mattetti","ctennis","lawrencepit","marcjeanson","grempe","peterc","ministrycentered","afarnham","up_the_irons","evilchelu","heavysixer","brosner","danielmorrison","danielharan","kvnsmth","collectiveidea","canadaduane","nate","dstrelau","sunny","dkubb","jnicklas","richcollins","simonjefford"])
|
||||
|
||||
def testGetUsersSince(self):
|
||||
self.assertListKeyBegin(self.g.get_users(since=1000), lambda u: u.login, ["sbecker"])
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user