Skip to content

Commit 6973ee4

Browse files
committed
Added user {,un}follow tests.
1 parent 0b45f84 commit 6973ee4

3 files changed

Lines changed: 46 additions & 1 deletion
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
status: 200
2+
x-ratelimit-remaining: 58
3+
content-location: https://github.com/api/v2/json/user/show/mojombo
4+
x-runtime: 23ms
5+
content-length: 63
6+
server: nginx/0.7.67
7+
connection: keep-alive
8+
x-ratelimit-limit: 60
9+
etag: "45a6fa1730ba70b40ccd595130b2390e"
10+
cache-control: private, max-age=0, must-revalidate
11+
date: Mon, 11 Apr 2011 14:46:22 GMT
12+
content-type: application/json; charset=utf-8
13+
14+
{"users":["c9s","mitsuhiko","seemant","ask","tpope","defunkt"]}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
status: 200
2+
x-ratelimit-remaining: 58
3+
content-location: http://github.com/api/v2/json/user/unfollow/defunkt
4+
x-runtime: 23ms
5+
content-length: 53
6+
server: nginx/0.7.67
7+
connection: keep-alive
8+
x-ratelimit-limit: 60
9+
etag: "45a6fa1730ba70b40ccd595130b2390e"
10+
cache-control: private, max-age=0, must-revalidate
11+
date: Mon, 11 Apr 2011 14:46:22 GMT
12+
content-type: application/json; charset=utf-8
13+
14+
{"users":["c9s","mitsuhiko","seemant","ask","tpope"]}

tests/test_user.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import unittest
44

5-
from nose.tools import (assert_equals, assert_true)
5+
from nose.tools import (assert_equals, assert_false, assert_true)
66

77
import utils
88

@@ -69,3 +69,20 @@ def test_search(self):
6969
def test_search_by_email(self):
7070
user = self.client.users.search_by_email('jnrowe@gmail.com')
7171
assert_equals(repr(user), '<User: JNRowe>')
72+
73+
74+
class UserMethods(unittest.TestCase):
75+
def setUp(self):
76+
utils.set_http_mock()
77+
self.client = Github()
78+
79+
def tearDown(self):
80+
utils.unset_http_mock()
81+
82+
def test_follow(self):
83+
result = self.client.users.follow('defunkt')
84+
assert_true('defunkt' in result['users'])
85+
86+
def test_unfollow(self):
87+
result = self.client.users.unfollow('defunkt')
88+
assert_false('defunkt' in result['users'])

0 commit comments

Comments
 (0)