Fix create/update/destroy lists for v1.1.
authorJoshua Roesslein <jroesslein@gmail.com>
Sun, 20 Jan 2013 22:18:51 +0000 (14:18 -0800)
committerJoshua Roesslein <jroesslein@gmail.com>
Sun, 20 Jan 2013 22:18:51 +0000 (14:18 -0800)
tests.py
tweepy/api.py

index 7fa0d3552a7a7b16e4502922ecc9524921a84be2..407a3959d70b024adfc8c18c6994d5df62dd3942 100644 (file)
--- a/tests.py
+++ b/tests.py
@@ -244,10 +244,14 @@ class TweepyAPITests(unittest.TestCase):
         self.api.blocks_ids()
 
     def testcreateupdatedestroylist(self):
-        self.api.create_list('tweeps')
-        # XXX: right now twitter throws a 500 here, issue is being looked into by twitter.
-        #self.api.update_list('tweeps', mode='private')
-        self.api.destroy_list('tweeps')
+        params = {
+            'owner_screen_name': username,
+            'slug': 'tweeps'
+        }
+        self.api.create_list(name=params['slug'], **params)
+        l = self.api.update_list(description='updated!', **params)
+        self.assertEqual(l.description, 'updated!')
+        self.api.destroy_list(**params)
 
     def testlists(self):
         self.api.lists()
index aa232c7553fce613f5246b16fd861f10e3cf0a87..b553aa0a38c04a4bbb1a913a364642c831dc6534 100644 (file)
@@ -533,31 +533,29 @@ class API(object):
             return False
         return True
 
-    def create_list(self, *args, **kargs):
-        return bind_api(
-            path = '/%s/lists.json' % self.auth.get_username(),
-            method = 'POST',
-            payload_type = 'list',
-            allowed_param = ['name', 'mode', 'description'],
-            require_auth = True
-        )(self, *args, **kargs)
+    create_list = bind_api(
+        path = '/lists/create.json',
+        method = 'POST',
+        payload_type = 'list',
+        allowed_param = ['name', 'mode', 'description'],
+        require_auth = True
+    )
 
-    def destroy_list(self, slug):
-        return bind_api(
-            path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),
-            method = 'DELETE',
-            payload_type = 'list',
-            require_auth = True
-        )(self)
+    destroy_list = bind_api(
+        path = '/lists/destroy.json',
+        method = 'POST',
+        payload_type = 'list',
+        allowed_param = ['owner_screen_name', 'owner_id', 'list_id', 'slug'],
+        require_auth = True
+    )
 
-    def update_list(self, slug, *args, **kargs):
-        return bind_api(
-            path = '/%s/lists/%s.json' % (self.auth.get_username(), slug),
-            method = 'POST',
-            payload_type = 'list',
-            allowed_param = ['name', 'mode', 'description'],
-            require_auth = True
-        )(self, *args, **kargs)
+    update_list = bind_api(
+        path = '/lists/update.json',
+        method = 'POST',
+        payload_type = 'list',
+        allowed_param = ['list_id', 'slug', 'name', 'mode', 'description', 'owner_screen_name', 'owner_id'],
+        require_auth = True
+    )
 
     lists = bind_api(
         path = '/{user}/lists.json',