added multiple list members operatio api methods
authorkk6 <kekelo1603@gmail.com>
Sat, 9 Mar 2013 11:57:04 +0000 (20:57 +0900)
committerkk6 <kekelo1603@gmail.com>
Sat, 9 Mar 2013 11:57:04 +0000 (20:57 +0900)
tests.py
tweepy/api.py

index 20d4a1bc1d3325a85447f64d8af3ecec9ded1856..5fb77726e8b478cf9e76878efeb946810420fee0 100644 (file)
--- a/tests.py
+++ b/tests.py
@@ -277,6 +277,19 @@ class TweepyAPITests(unittest.TestCase):
         assert_list(self.api.add_list_member(**params))
         assert_list(self.api.remove_list_member(**params))
 
+    def testaddremovelistmembers(self):
+        params = {
+            'slug': 'test',
+            'owner_screen_name': username,
+            'screen_name': 'twitterapi,twittermobile'
+        }
+
+        def assert_list(l):
+            self.assertEqual(l.name, params['slug'])
+
+        assert_list(self.api.add_list_members(**params))
+        assert_list(self.api.remove_list_members(**params))
+
     def testlistmembers(self):
         self.api.list_members('applepie', 'stars')
 
index b0fbb905777e40711bf6bbac7a68ab0c5d76ffbd..84640907e9ff26e151df17fe65e3ebb76fbb9480 100644 (file)
@@ -574,6 +574,22 @@ class API(object):
         require_auth = True
     )
 
+    add_list_members = bind_api(
+        path = '/lists/members/create_all.json',
+        method = 'POST',
+        payload_type = 'list',
+        allowed_param = ['screen_name', 'user_id', 'owner_screen_name', 'owner_id', 'slug', 'list_id'],
+        require_auth = True
+    )
+
+    remove_list_members = bind_api(
+        path = '/lists/members/destroy_all.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 = '/lists/members.json',
         payload_type = 'user', payload_list = True,