Skip to content

Commit 0e4fd56

Browse files
committed
add support for extra follow data
1 parent 9ca7766 commit 0e4fd56

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def run_tests(self):
4343
# import here, cause outside the eggs aren't loaded
4444
import pytest
4545
errno = pytest.main(
46-
'stream/tests.py --cov stream --cov-report term-missing -v')
46+
'stream/tests.py --cov stream --cov-report term-missing -v -k follow')
4747
sys.exit(errno)
4848

4949
setup(

‎stream/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
__copyright__ = 'Copyright 2014, Thierry Schellenbach'
66
__credits__ = ['Thierry Schellenbach, mellowmorning.com, @tschellenbach']
77
__license__ = 'BSD'
8-
__version__ = '2.1.3'
8+
__version__ = '2.1.4'
99
__maintainer__ = 'Thierry Schellenbach'
1010
__email__ = 'thierryschellenbach@gmail.com'
1111
__status__ = 'Production'

‎stream/feed.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def get(self, **params):
104104
self.feed_url, params=params, signature=self.signature)
105105
return response
106106

107-
def follow(self, target_feed_slug, target_user_id):
107+
def follow(self, target_feed_slug, target_user_id, **extra_data):
108108
'''
109109
Follows the given feed
110110
@@ -119,6 +119,7 @@ def follow(self, target_feed_slug, target_user_id):
119119
'target': target_feed_id,
120120
'target_token': self.client.feed(target_feed_slug, target_user_id).token
121121
}
122+
data.update(extra_data)
122123
response = self.client.post(
123124
url, data=data, signature=self.signature)
124125
return response
@@ -149,11 +150,12 @@ def followers(self, offset=0, limit=25, feeds=None):
149150
url, params=params, signature=self.signature)
150151
return response
151152

152-
def following(self, offset=0, limit=25, feeds=None):
153+
def following(self, offset=0, limit=25, feeds=None, filter=None):
153154
'''
154155
List the feeds which this feed is following
155156
'''
156-
feeds = feeds is not None and ','.join(feeds) or ''
157+
if feeds is not None:
158+
feeds = feeds is not None and ','.join(feeds) or ''
157159
params = {
158160
'offset': offset,
159161
'limit': limit,

‎stream/tests.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@ def test_flat_follow(self):
269269
activity_id_found = activity['id'] if activity is not None else None
270270
self.assertEqual(activity_id_found, activity_id)
271271

272+
def test_flat_follow_no_copy(self):
273+
feed = getfeed('user', 'test_flat_follow_no_copy')
274+
follower = getfeed('flat', 'test_flat_follow_no_copy')
275+
activity_data = {'actor': 1, 'verb': 'tweet', 'object': 1}
276+
feed.add_activity(activity_data)['id']
277+
follower.follow(feed.slug, feed.user_id, activity_copy_limit=0)
278+
time.sleep(10)
279+
activities = follower.get(limit=3)['results']
280+
self.assertEqual(activities, [])
281+
272282
def _get_first_aggregated_activity(self, activities):
273283
try:
274284
return activities[0]['activities'][0]

0 commit comments

Comments
 (0)