Commit b144a8e6 authored by Joshua Roesslein's avatar Joshua Roesslein
Browse files

Fix list add/remove members for v1.1.

parent e0fff3c4
......@@ -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')
......
......@@ -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',
......
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