Commit 5be12310 authored by Joshua Roesslein's avatar Joshua Roesslein
Browse files

Fix create/update/destroy lists for v1.1.

parent 5aec7a3f
......@@ -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()
......
......@@ -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',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment