File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ def add_activity(self, activity_data):
46
46
activity_data = {'actor': 1, 'verb': 'tweet', 'object': 1}
47
47
activity_id = feed.add_activity(activity_data)
48
48
'''
49
+ if activity_data .get ('to' ) and type (activity_data .get ('to' )) is str :
50
+ raise TypeError ('please provide the activity\' s to field as a list not a string' )
51
+
49
52
if activity_data .get ('to' ):
50
53
activity_data ['to' ] = self .add_to_signature (activity_data ['to' ])
51
54
Original file line number Diff line number Diff line change @@ -155,6 +155,17 @@ def test_add_activity_to(self):
155
155
# and the flat feed
156
156
activities = team_follower_feed .get (limit = 1 )['results' ]
157
157
self .assertFirstActivityIDNotEqual (activities , activity_id )
158
+
159
+
160
+ def test_add_activity_to_type_error (self ):
161
+ user_feed = getfeed ('user' , '1' )
162
+ activity_data = {
163
+ 'actor' : 1 , 'verb' : 'tweet' , 'object' : 1 ,
164
+ 'to' : 'string'
165
+ }
166
+
167
+ with self .assertRaises (TypeError ):
168
+ user_feed .add_activity (activity_data )
158
169
159
170
def assertFirstActivityIDEqual (self , activities , correct_activity_id ):
160
171
activity_id = None
You can’t perform that action at this time.
0 commit comments