From: Joshua Roesslein Date: Sun, 20 Jan 2013 21:42:59 +0000 (-0800) Subject: Fix list add/remove members for v1.1. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b144a8e617525f7a6896b68270fcf5bb437e02a9;p=tweepy.git Fix list add/remove members for v1.1. --- diff --git a/tests.py b/tests.py index 1cf1ccf..c1957e9 100644 --- a/tests.py +++ b/tests.py @@ -271,9 +271,17 @@ class TweepyAPITests(unittest.TestCase): self.api.get_list('applepie', 'stars') def testaddremovelistmember(self): - uid = self.api.get_user('twitter').id - self.api.add_list_member('test', uid) - self.api.remove_list_member('test', uid) + params = { + 'slug': 'test', + 'owner_screen_name': username, + 'screen_name': 'twitter' + } + + def assert_list(l): + self.assertEqual(l.name, params['slug']) + + assert_list(self.api.add_list_member(**params)) + assert_list(self.api.remove_list_member(**params)) def testlistmembers(self): self.api.list_members('applepie', 'stars') diff --git a/tweepy/api.py b/tweepy/api.py index f8c7b1a..869d488 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -622,23 +622,21 @@ class API(object): allowed_param = ['owner', 'slug'] ) - def add_list_member(self, slug, *args, **kargs): - return bind_api( - path = '/%s/%s/members.json' % (self.auth.get_username(), slug), - method = 'POST', - payload_type = 'list', - allowed_param = ['id'], - require_auth = True - )(self, *args, **kargs) + add_list_member = bind_api( + path = '/lists/members/create.json', + method = 'POST', + payload_type = 'list', + allowed_param = ['screen_name', 'user_id', 'owner_screen_name', 'owner_id', 'slug', 'list_id'], + require_auth = True + ) - def remove_list_member(self, slug, *args, **kargs): - return bind_api( - path = '/%s/%s/members.json' % (self.auth.get_username(), slug), - method = 'DELETE', - payload_type = 'list', - allowed_param = ['id'], - require_auth = True - )(self, *args, **kargs) + remove_list_member = bind_api( + path = '/lists/members/destroy.json', + method = 'POST', + payload_type = 'list', + allowed_param = ['screen_name', 'user_id', 'owner_screen_name', 'owner_id', 'slug', 'list_id'], + require_auth = True + ) list_members = bind_api( path = '/{owner}/{slug}/members.json',