Skip to content

Commit 2debd71

Browse files
committed
Added user querying tests.
1 parent e037092 commit 2debd71

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
status: 304
2+
x-ratelimit-remaining: 58
3+
content-location: https://github.com/api/v2/json/user/email/jnrowe%40gmail.com
4+
connection: keep-alive
5+
content-length: 370
6+
server: nginx/0.7.67
7+
x-runtime: 11ms
8+
x-ratelimit-limit: 60
9+
etag: "56cf9af8aa57da3ccc78fc91d6df4565"
10+
cache-control: private, max-age=0, must-revalidate
11+
date: Sun, 22 May 2011 04:42:13 GMT
12+
content-type: application/json; charset=utf-8
13+
14+
{"user":{"gravatar_id":"e40de1eb6e8a74cb96b3f07f3994f155","company":null,"name":"James Rowe","created_at":"2009/03/08 14:53:38 -0700","location":"Cambridge, UK","public_repo_count":38,"public_gist_count":64,"blog":"http://jnrowe.github.com/","following_count":5,"id":61381,"type":"User","permission":null,"followers_count":6,"login":"JNRowe","email":"jnrowe@gmail.com"}}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
status: 304
2+
x-ratelimit-remaining: 59
3+
content-location: https://github.com/api/v2/json/user/search/James%2BRowe
4+
content-length: 847
5+
server: nginx/0.7.67
6+
connection: keep-alive
7+
x-ratelimit-limit: 60
8+
etag: "f4b69010d01df911cd62a2c2eef3d71f"
9+
cache-control: private, max-age=0, must-revalidate
10+
date: Sun, 22 May 2011 04:42:12 GMT
11+
content-type: application/json; charset=utf-8
12+
x-runtime: 10ms
13+
14+
{"users":[{"gravatar_id":"e40de1eb6e8a74cb96b3f07f3994f155","name":"James Rowe","created_at":"2009-03-08T21:53:38Z","location":"Cambridge, UK","public_repo_count":38,"followers":6,"fullname":"James Rowe","username":"JNRowe","language":"Python","id":"user-61381","repos":38,"type":"user","followers_count":6,"pushed":"2011-05-21T06:15:08.703Z","login":"JNRowe","score":4.247995,"record":null,"created":"2009-03-08T21:53:38Z"},{"gravatar_id":"e70f90f2a6985553d18fa39b90d9db6f","name":"James Rowe","created_at":"2008-11-18T10:39:10Z","location":"Guernsey, Channel Islands","public_repo_count":2,"followers":1,"fullname":"James Rowe","language":"Ruby","username":"wooki","id":"user-35166","repos":2,"type":"user","followers_count":1,"pushed":"2011-05-13T19:15:09.524Z","login":"wooki","score":4.247995,"record":null,"created":"2008-11-18T10:39:10Z"}]}

tests/test_user.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,21 @@ def test_followers(self):
4545

4646
def test_following(self):
4747
assert_equals(len(self.client.users.following('defunkt')), 212)
48+
49+
50+
class UserQueries(unittest.TestCase):
51+
"""Test user querying """
52+
def setUp(self):
53+
utils.set_http_mock()
54+
self.client = Github()
55+
56+
def tearDown(self):
57+
utils.unset_http_mock()
58+
59+
def test_search(self):
60+
assert_equals(repr(self.client.users.search('James Rowe')),
61+
'[<User: JNRowe>, <User: wooki>]')
62+
63+
def test_search_by_email(self):
64+
user = self.client.users.search_by_email('jnrowe@gmail.com')
65+
assert_equals(repr(user), '<User: JNRowe>')

0 commit comments

Comments
 (0)