Fix list add/remove members for v1.1.
authorJoshua Roesslein <jroesslein@gmail.com>
Sun, 20 Jan 2013 21:42:59 +0000 (13:42 -0800)
committerJoshua Roesslein <jroesslein@gmail.com>
Sun, 20 Jan 2013 21:42:59 +0000 (13:42 -0800)
tests.py
tweepy/api.py

index 1cf1ccf77125c2b80be24b4b33d1f216f5e64b15..c1957e94f403856b5edd0629a1191417ba62dc60 100644 (file)
--- 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')
index f8c7b1a5e876f7d32c279d7de728d8b03575e40c..869d488233e5552f7e799570dc963c195536b222 100644 (file)
@@ -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',