Browse files

Less than 1000 lines to test.

  • Loading branch information...
1 parent d417bf0 commit f2b7aea4dcf00ca2ceb9774e7e08eb9b6fe3416a @sigmavirus24 committed Jan 2, 2013
Showing with 37 additions and 8 deletions.
  1. +1 −1 github3/api.py
  2. +36 −7 tests/test_api.py
View
2 github3/api.py
@@ -340,7 +340,7 @@ def user(login):
def ratelimit_remaining():
"""Get the remaining number of requests allowed."""
- return gh.ratelimit_remaining
+ return gh.ratelimit_remaining()
def zen():
View
43 tests/test_api.py
@@ -1,5 +1,6 @@
import github3
from tests.utils import APITestMixin
+from mock import patch
class TestAPI(APITestMixin):
@@ -10,7 +11,11 @@ def test_authorize(self):
self.gh.authorize.assert_called_with(*args)
def test_login(self):
- pass
+ args = ('login', 'password', None)
+ with patch.object(github3.api.GitHub, 'login') as login:
+ g = github3.login(*args)
+ assert isinstance(g, github3.github.GitHub)
+ login.assert_called_with(*args)
def test_gist(self):
args = (123,)
@@ -55,6 +60,8 @@ def test_iter_repo_issues(self):
github3.iter_repo_issues(*args)
self.gh.iter_repo_issues.assert_called_with(*args)
+ github3.iter_repo_issues(None, None)
+
def test_iter_orgs(self):
args = ('login', -1)
github3.iter_orgs(*args)
@@ -65,6 +72,8 @@ def test_iter_repos(self):
github3.iter_repos(*args)
self.gh.iter_repos.assert_called_with(*args)
+ github3.iter_repos(None)
+
def test_iter_starred(self):
github3.iter_starred('login')
self.gh.iter_starred.assert_called_with('login', -1)
@@ -111,9 +120,29 @@ def test_search_issues(self):
github3.search_issues(*args)
self.gh.search_issues.assert_called_with(*args)
-#def search_repos(keyword, **params):
-#def search_users(keyword):
-#def search_email(email):
-#def user(login):
-#def ratelimit_remaining():
-#def zen():
+ def test_search_repos(self):
+ args = ('keyword',)
+ github3.search_repos(*args)
+ self.gh.search_repos.assert_called_with(*args)
+
+ def test_search_users(self):
+ args = ('login',)
+ github3.search_users(*args)
+ self.gh.search_users.assert_called_with(*args)
+
+ def test_search_email(self):
+ args = ('email',)
+ github3.search_email(*args)
+ self.gh.search_email.assert_called_with(*args)
+
+ def test_user(self):
+ github3.user('login')
+ self.gh.user.assert_called_with('login')
+
+ def test_ratelimit_remaining(self):
+ github3.ratelimit_remaining()
+ assert self.gh.ratelimit_remaining.called is True
+
+ def test_zen(self):
+ github3.zen()
+ assert self.gh.zen.called is True

0 comments on commit f2b7aea

Please sign in to comment.