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>
Thu, 27 Mar 2014 16:44:19 +0000 (01:44 +0900)
tests/test_api.py
tweepy/api.py

index ab5c4c78b999900d1f4edbde6b504e987c54f23c..8419fb4997cf1c6200dfa9bf91cf33b1a264f49d 100644 (file)
@@ -280,6 +280,19 @@ class TweepyAPITests(TweepyTestCase):
         sleep(3)
         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 1d530790290e0e84ccc629d306f9537b3dba2bca..a538491be61759c4cb915d6a7009b0abdd202168 100644 (file)
@@ -576,6 +576,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,